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
Roque
slapos.core
Commits
acd9d4b1
Commit
acd9d4b1
authored
Apr 27, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement "security".
parent
15cdade1
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
570 additions
and
7 deletions
+570
-7
master/bt5/vifib_slapos_rest_api_v1/ActionTemplateItem/portal_types/System%20Preference/vifib_rest_api_v1_preference.xml
...ypes/System%20Preference/vifib_rest_api_v1_preference.xml
+85
-0
master/bt5/vifib_slapos_rest_api_v1/PropertySheetTemplateItem/portal_property_sheets/VifibRestAPIV1SystemPreference.xml
...portal_property_sheets/VifibRestAPIV1SystemPreference.xml
+66
-0
master/bt5/vifib_slapos_rest_api_v1/PropertySheetTemplateItem/portal_property_sheets/VifibRestAPIV1SystemPreference/preferred_rest_api_v1_token_server_url_property.xml
...rence/preferred_rest_api_v1_token_server_url_property.xml
+71
-0
master/bt5/vifib_slapos_rest_api_v1/SkinTemplateItem/portal_skins/vifib_slapos_rest_api_v1.xml
...kinTemplateItem/portal_skins/vifib_slapos_rest_api_v1.xml
+47
-0
master/bt5/vifib_slapos_rest_api_v1/SkinTemplateItem/portal_skins/vifib_slapos_rest_api_v1/SystemPreference_viewVifibRestAPIV1.xml
...lapos_rest_api_v1/SystemPreference_viewVifibRestAPIV1.xml
+152
-0
master/bt5/vifib_slapos_rest_api_v1/SkinTemplateItem/portal_skins/vifib_slapos_rest_api_v1/SystemPreference_viewVifibRestAPIV1/my_preferred_rest_api_v1_token_server_url.xml
...ibRestAPIV1/my_preferred_rest_api_v1_token_server_url.xml
+126
-0
master/bt5/vifib_slapos_rest_api_v1/bt/revision
master/bt5/vifib_slapos_rest_api_v1/bt/revision
+1
-1
master/bt5/vifib_slapos_rest_api_v1/bt/template_action_path_list
...bt5/vifib_slapos_rest_api_v1/bt/template_action_path_list
+1
-0
master/bt5/vifib_slapos_rest_api_v1/bt/template_property_sheet_id_list
...fib_slapos_rest_api_v1/bt/template_property_sheet_id_list
+1
-0
master/bt5/vifib_slapos_rest_api_v1/bt/template_skin_id_list
master/bt5/vifib_slapos_rest_api_v1/bt/template_skin_id_list
+1
-0
master/product/Vifib/Tool/VifibRestApiV1Tool.py
master/product/Vifib/Tool/VifibRestApiV1Tool.py
+19
-6
No files found.
master/bt5/vifib_slapos_rest_api_v1/ActionTemplateItem/portal_types/System%20Preference/vifib_rest_api_v1_preference.xml
0 → 100644
View file @
acd9d4b1
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ActionInformation"
module=
"Products.CMFCore.ActionInformation"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
action_type/object_view
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
category
</string>
</key>
<value>
<string>
object_view
</string>
</value>
</item>
<item>
<key>
<string>
condition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
icon
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
vifib_rest_api_v1_preference
</string>
</value>
</item>
<item>
<key>
<string>
permissions
</string>
</key>
<value>
<tuple>
<string>
View
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Action Information
</string>
</value>
</item>
<item>
<key>
<string>
priority
</string>
</key>
<value>
<float>
11.0
</float>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Vifib Rest API V1
</string>
</value>
</item>
<item>
<key>
<string>
visible
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Expression"
module=
"Products.CMFCore.Expression"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
text
</string>
</key>
<value>
<string>
string:${object_url}/SystemPreference_viewVifibRestAPIV1
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_slapos_rest_api_v1/PropertySheetTemplateItem/portal_property_sheets/VifibRestAPIV1SystemPreference.xml
0 → 100644
View file @
acd9d4b1
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Property Sheet"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_count
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_mt_index
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_tree
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
VifibRestAPIV1SystemPreference
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Property Sheet
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Length"
module=
"BTrees.Length"
/>
</pickle>
<pickle>
<int>
0
</int>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"OOBTree"
module=
"BTrees.OOBTree"
/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"OOBTree"
module=
"BTrees.OOBTree"
/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_slapos_rest_api_v1/PropertySheetTemplateItem/portal_property_sheets/VifibRestAPIV1SystemPreference/preferred_rest_api_v1_token_server_url_property.xml
0 → 100644
View file @
acd9d4b1
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Standard Property"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_local_properties
</string>
</key>
<value>
<tuple>
<dictionary>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
mode
</string>
</value>
</item>
<item>
<key>
<string>
type
</string>
</key>
<value>
<string>
string
</string>
</value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
elementary_type/string
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string>
Stores token server URL
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
preferred_rest_api_v1_token_server_url_property
</string>
</value>
</item>
<item>
<key>
<string>
mode
</string>
</key>
<value>
<string>
w
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Standard Property
</string>
</value>
</item>
<item>
<key>
<string>
preference
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
property_default
</string>
</key>
<value>
<string>
python: \'\'
</string>
</value>
</item>
<item>
<key>
<string>
read_permission
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
write_permission
</string>
</key>
<value>
<string>
Manage properties
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_slapos_rest_api_v1/SkinTemplateItem/portal_skins/vifib_slapos_rest_api_v1.xml
0 → 100644
View file @
acd9d4b1
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Folder"
module=
"OFS.Folder"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_local_properties
</string>
</key>
<value>
<tuple>
<dictionary>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
business_template_skin_layer_priority
</string>
</value>
</item>
<item>
<key>
<string>
type
</string>
</key>
<value>
<string>
float
</string>
</value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key>
<string>
_objects
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
business_template_skin_layer_priority
</string>
</key>
<value>
<float>
60.0
</float>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
vifib_slapos_rest_api_v1
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_slapos_rest_api_v1/SkinTemplateItem/portal_skins/vifib_slapos_rest_api_v1/SystemPreference_viewVifibRestAPIV1.xml
0 → 100644
View file @
acd9d4b1
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ERP5Form"
module=
"Products.ERP5Form.Form"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_objects
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
Base_edit
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
edit_order
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
encoding
</string>
</key>
<value>
<string>
UTF-8
</string>
</value>
</item>
<item>
<key>
<string>
enctype
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
group_list
</string>
</key>
<value>
<list>
<string>
left
</string>
<string>
right
</string>
<string>
center
</string>
<string>
bottom
</string>
<string>
hidden
</string>
</list>
</value>
</item>
<item>
<key>
<string>
groups
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
bottom
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
center
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
left
</string>
</key>
<value>
<list>
<string>
my_preferred_rest_api_v1_token_server_url
</string>
</list>
</value>
</item>
<item>
<key>
<string>
right
</string>
</key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
SystemPreference_viewVifibRestAPIV1
</string>
</value>
</item>
<item>
<key>
<string>
method
</string>
</key>
<value>
<string>
POST
</string>
</value>
</item>
<item>
<key>
<string>
name
</string>
</key>
<value>
<string>
SystemPreference_viewVifibRestAPIV1
</string>
</value>
</item>
<item>
<key>
<string>
pt
</string>
</key>
<value>
<string>
form_view
</string>
</value>
</item>
<item>
<key>
<string>
row_length
</string>
</key>
<value>
<int>
4
</int>
</value>
</item>
<item>
<key>
<string>
stored_encoding
</string>
</key>
<value>
<string>
UTF-8
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Vifib Rest API V1
</string>
</value>
</item>
<item>
<key>
<string>
unicode_mode
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
update_action
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
update_action_title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_slapos_rest_api_v1/SkinTemplateItem/portal_skins/vifib_slapos_rest_api_v1/SystemPreference_viewVifibRestAPIV1/my_preferred_rest_api_v1_token_server_url.xml
0 → 100644
View file @
acd9d4b1
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
items
</string>
<string>
title
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
my_preferred_rest_api_v1_token_server_url
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
items
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_reference
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
items
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string>
Click to edit the target
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Preferred Token Server URL
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"TALESMethod"
module=
"Products.Formulator.TALESField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<string>
python: [(\'\', \'\')] + [(x.getTitle(), x.getRelativeUrl()) for x in here.portal_catalog(portal_type=\'Service\', sort_on=((\'title\', \'ASC\'),),checked_permission=\'View\')]
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_slapos_rest_api_v1/bt/revision
View file @
acd9d4b1
1
\ No newline at end of file
2
\ No newline at end of file
master/bt5/vifib_slapos_rest_api_v1/bt/template_action_path_list
0 → 100644
View file @
acd9d4b1
System Preference | vifib_rest_api_v1_preference
\ No newline at end of file
master/bt5/vifib_slapos_rest_api_v1/bt/template_property_sheet_id_list
0 → 100644
View file @
acd9d4b1
VifibRestAPIV1SystemPreference
\ No newline at end of file
master/bt5/vifib_slapos_rest_api_v1/bt/template_skin_id_list
0 → 100644
View file @
acd9d4b1
vifib_slapos_rest_api_v1
\ No newline at end of file
master/product/Vifib/Tool/VifibRestApiV1Tool.py
View file @
acd9d4b1
...
...
@@ -30,14 +30,29 @@
from
Acquisition
import
Implicit
from
Products.ERP5Type.Tool.BaseTool
import
BaseTool
from
AccessControl
import
ClassSecurityInfo
from
AccessControl
import
ClassSecurityInfo
,
getSecurityManager
from
Products.ERP5Type.Globals
import
InitializeClass
from
Products.ERP5Type
import
Permissions
from
ComputedAttribute
import
ComputedAttribute
def
responseSupport
(
fn
):
def
wrapper
(
self
,
*
args
,
**
kwargs
):
response
=
self
.
REQUEST
.
response
response
.
setHeader
(
'Access-Control-Allow-Origin'
,
'*'
)
response
.
setHeader
(
'Access-Control-Allow-Methods'
,
'DELETE, PUT, POST, '
'GET, OPTIONS'
)
if
getSecurityManager
().
getUser
().
getId
()
is
None
:
# force login
response
.
setStatus
(
401
)
response
.
setHeader
(
'WWW-Authenticate'
,
'Bearer realm="%s"'
%
self
.
absolute_url
())
response
.
setHeader
(
'Location'
,
self
.
getPortalObject
()
\
.
portal_preferences
.
getPreferredRestApiV1TokenServerUrl
())
return
response
return
fn
(
self
,
*
args
,
**
kwargs
)
wrapper
.
__doc__
=
fn
.
__doc__
return
wrapper
class
GenericPublisher
(
Implicit
):
security
=
ClassSecurityInfo
()
security
.
declarePublic
(
'OPTIONS'
)
def
OPTIONS
(
self
,
*
args
,
**
kwargs
):
"""HTTP OPTIONS implementation"""
response
=
self
.
REQUEST
.
response
...
...
@@ -64,10 +79,8 @@ class GenericPublisher(Implicit):
class
InstancePublisher
(
GenericPublisher
):
"""Instance publisher"""
security
=
ClassSecurityInfo
()
security
.
declareObjectPublic
()
security
.
declarePublic
(
'DELETE'
)
@
responseSupport
def
DELETE
(
self
,
*
args
,
**
kwargs
):
"""HTTP DELETE implementation"""
response
=
self
.
prepareResponse
()
...
...
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