Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xavier Thompson
slapos.core
Commits
4d8e1fe1
Commit
4d8e1fe1
authored
May 21, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support non Person loggable users.
parent
ade1e544
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
master/product/Vifib/Tool/VifibRestApiV1Tool.py
master/product/Vifib/Tool/VifibRestApiV1Tool.py
+10
-7
No files found.
master/product/Vifib/Tool/VifibRestApiV1Tool.py
View file @
4d8e1fe1
...
...
@@ -31,6 +31,7 @@
from
Acquisition
import
Implicit
from
Products.ERP5Type.Tool.BaseTool
import
BaseTool
from
AccessControl
import
ClassSecurityInfo
,
getSecurityManager
,
Unauthorized
from
Products.Vifib.VifibMachineAuthenticationPlugin
import
getUserByLogin
from
Products.ERP5Type.Globals
import
InitializeClass
from
Products.ERP5Type
import
Permissions
from
ComputedAttribute
import
ComputedAttribute
...
...
@@ -174,18 +175,20 @@ def responseSupport(anonymous=False):
.
portal_preferences
.
getPreferredRestApiV1TokenServerUrl
())
return
self
.
REQUEST
.
response
else
:
person
=
self
.
getPortalObject
().
ERP5Site_getAuthenticatedMemberPersonValue
()
if
person
is
None
:
user_name
=
self
.
getPortalObject
().
portal_membership
\
.
getAuthenticatedMember
()
user_document
=
getUserByLogin
(
self
.
getPortalObject
(),
str
(
user_name
))
if
len
(
user_document
)
!=
1
:
transaction
.
abort
()
LOG
(
'VifibRestApiV1Tool'
,
ERROR
,
'Currenty logged in user %r has no Person document.'
%
str
(
self
.
getPortalObject
().
portal_membership
.
getAuthenticatedMember
()))
'Currenty logged in user %r wrong document list %r.'
%
(
user_name
,
user_document
))
self
.
REQUEST
.
response
.
setStatus
(
500
)
self
.
REQUEST
.
response
.
setBody
(
jsonify
({
'error'
:
'There is system issue, please try again later.'
}))
return
self
.
REQUEST
.
response
self
.
person_url
=
person
.
getRelativeUrl
()
self
.
user_url
=
user_document
[
0
]
.
getRelativeUrl
()
return
fn
(
self
,
*
args
,
**
kwargs
)
wrapperResponseSupport
.
__doc__
=
fn
.
__doc__
return
wrapperResponseSupport
...
...
@@ -329,7 +332,7 @@ class InstancePublisher(GenericPublisher):
{
'status'
:
'Status shall be one of: started, stopped, destroyed.'
}))
return
self
.
REQUEST
.
response
try
:
self
.
restrictedTraverse
(
self
.
person
_url
self
.
restrictedTraverse
(
self
.
user
_url
).
requestSoftwareInstance
(
**
request_dict
)
except
Exception
:
transaction
.
abort
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment