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
Lu Xu
slapos.core
Commits
5fcfcdbd
Commit
5fcfcdbd
authored
Aug 16, 2019
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: Role for Certificate Login
parent
8fb61610
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
79 additions
and
5 deletions
+79
-5
master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Certificate%20Login.xml
..._erp5/PortalTypeRolesTemplateItem/Certificate%20Login.xml
+9
-0
master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/ERP5%20Login.xml
.../slapos_erp5/PortalTypeRolesTemplateItem/ERP5%20Login.xml
+1
-1
master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Person.xml
...er/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Person.xml
+2
-2
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
...l_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
+66
-2
master/bt5/slapos_erp5/bt/template_portal_type_role_list
master/bt5/slapos_erp5/bt/template_portal_type_role_list
+1
-0
No files found.
master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Certificate%20Login.xml
0 → 100644
View file @
5fcfcdbd
<type_roles>
<role
id=
'Assignee'
>
<property
id=
'title'
>
The User Himself
</property>
<property
id=
'condition'
>
python: here.getParentValue().getPortalType() in ("Person", "Software Instance", "Computer")
</property>
<property
id=
'base_category_script'
>
ERP5Type_getSecurityCategoryFromParent
</property>
<multi_property
id=
'categories'
>
local_role_group/user
</multi_property>
<multi_property
id=
'base_category'
>
group
</multi_property>
</role>
</type_roles>
\ No newline at end of file
master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/ERP5%20Login.xml
View file @
5fcfcdbd
<type_roles>
<role
id=
'Assignee'
>
<property
id=
'title'
>
The User Himself
</property>
<property
id=
'condition'
>
python: here.getParentValue().getPortalType()
== "Person"
</property>
<property
id=
'condition'
>
python: here.getParentValue().getPortalType()
in ("Person", "Software Instance", "Computer")
</property>
<property
id=
'base_category_script'
>
ERP5Type_getSecurityCategoryFromParent
</property>
<multi_property
id=
'categories'
>
local_role_group/user
</multi_property>
<multi_property
id=
'base_category'
>
group
</multi_property>
...
...
master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Person.xml
View file @
5fcfcdbd
...
...
@@ -8,7 +8,7 @@
<role
id=
'Auditor'
>
<property
id=
'title'
>
The Shadow User Himself
</property>
<property
id=
'description'
>
Monovalued role
</property>
<property
id=
'condition'
>
python: here.objectValues(portal_type=["ERP5 Login", "Google Login", "Facebook Login"])
</property>
<property
id=
'condition'
>
python: here.objectValues(portal_type=["ERP5 Login", "Google Login", "Facebook Login"
, "Certificate Login"
])
</property>
<property
id=
'base_category_script'
>
PersonType_getSecurityCategoryFromSelfShadow
</property>
<multi_property
id=
'categories'
>
local_role_group/shadow
</multi_property>
<multi_property
id=
'base_category'
>
group
</multi_property>
...
...
@@ -16,7 +16,7 @@
<role
id=
'Assignee'
>
<property
id=
'title'
>
The User Himself
</property>
<property
id=
'description'
>
Monovalued role
</property>
<property
id=
'condition'
>
python: here.objectValues(portal_type=["ERP5 Login", "Google Login", "Facebook Login"])
</property>
<property
id=
'condition'
>
python: here.objectValues(portal_type=["ERP5 Login", "Google Login", "Facebook Login"
, "Certificate Login"
])
</property>
<property
id=
'base_category_script'
>
ERP5Type_getSecurityCategoryFromSelf
</property>
<multi_property
id=
'categories'
>
local_role_group/user
</multi_property>
<multi_property
id=
'base_category'
>
group
</multi_property>
...
...
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
View file @
5fcfcdbd
# Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved.
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2012-2019 Nexedi SA and Contributors.
#
# This program is free software: you can Use, Study, Modify and Redistribute
# it under the terms of the GNU General Public License version 3, or (at your
# option) any later version, as published by the Free Software Foundation.
#
# You can also Link and Combine this program with other software covered by
# the terms of any of the Free Software licenses or any of the Open Source
# Initiative approved licenses and Convey the resulting work. Corresponding
# source of such a combination shall include the source code for all other
# software used.
#
# This program is distributed WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options.
#
##############################################################################
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixinWithAbort
from
AccessControl
import
getSecurityManager
...
...
@@ -533,11 +554,15 @@ class TestPerson(TestSlapOSGroupRoleSecurityMixin):
def
test_TheUserHimself_Google
(
self
):
self
.
test_TheUserHimself
(
login_portal_type
=
"Google Login"
)
def
test_TheUserHimself_Certificate
(
self
):
self
.
test_TheUserHimself
(
login_portal_type
=
"Certificate Login"
)
class
TestERP5Login
(
TestSlapOSGroupRoleSecurityMixin
):
login_portal_type
=
"ERP5 Login"
def
test_
TheUserHimself
(
self
):
def
test_
PersonCanAccessLoginDocument
(
self
):
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
)
login
=
person
.
newContent
(
portal_type
=
self
.
login_portal_type
)
person
.
updateLocalRolesOnSecurityGroups
()
...
...
@@ -548,12 +573,51 @@ class TestERP5Login(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
login
,
person
.
getUserId
(),
[
'Assignee'
])
self
.
assertRoles
(
login
,
self
.
user_id
,
[
'Owner'
])
def
test_ComputerCanAccessLoginDocument
(
self
):
computer
=
self
.
portal
.
computer_module
.
newContent
(
portal_type
=
'Computer'
)
login
=
computer
.
newContent
(
portal_type
=
self
.
login_portal_type
)
computer
.
updateLocalRolesOnSecurityGroups
()
login
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
login
,
[
self
.
user_id
,
computer
.
getUserId
()],
False
)
self
.
assertRoles
(
login
,
computer
.
getUserId
(),
[
'Assignee'
])
self
.
assertRoles
(
login
,
self
.
user_id
,
[
'Owner'
])
def
test_SoftwareInstanceCanAccessLoginDocument
(
self
):
software_instance
=
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
'Software Instance'
)
login
=
software_instance
.
newContent
(
portal_type
=
self
.
login_portal_type
)
software_instance
.
updateLocalRolesOnSecurityGroups
()
login
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
login
,
[
self
.
user_id
,
software_instance
.
getUserId
()],
False
)
self
.
assertRoles
(
login
,
software_instance
.
getUserId
(),
[
'Assignee'
])
self
.
assertRoles
(
login
,
self
.
user_id
,
[
'Owner'
])
class
TestCertificateLogin
(
TestERP5Login
):
login_portal_type
=
"Certificate Login"
class
TestGoogleLogin
(
TestERP5Login
):
login_portal_type
=
"Google Login"
def
test_ComputerCanAccessLoginDocument
(
self
):
# Not supported to add google login inside Computer
pass
def
test_SoftwareInstanceCanAccessLoginDocument
(
self
):
# Not supported to add google login inside SoftwareInstance
pass
class
TestFacebookLogin
(
TestERP5Login
):
login_portal_type
=
"Facebook Login"
def
test_ComputerCanAccessLoginDocument
(
self
):
# Not supported to add google login inside Computer
pass
def
test_SoftwareInstanceCanAccessLoginDocument
(
self
):
# Not supported to add google login inside SoftwareInstance
pass
class
TestPersonModule
(
TestSlapOSGroupRoleSecurityMixin
):
def
test
(
self
):
...
...
master/bt5/slapos_erp5/bt/template_portal_type_role_list
View file @
5fcfcdbd
...
...
@@ -13,6 +13,7 @@ Business Process Module
Campaign
Campaign Module
Cash Register
Certificate Login
Cloud Contract
Cloud Contract Module
Component
...
...
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