Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
alecs_myu
erp5
Commits
88e9c81e
Commit
88e9c81e
authored
Sep 13, 2012
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Local roles group use a category not a string value any more.
Remove not used proeprty.
parent
88d54087
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
67 deletions
+31
-67
product/ERP5/Document/BusinessTemplate.py
product/ERP5/Document/BusinessTemplate.py
+3
-3
product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/RoleInformation/local_roles_group_id_property.xml
..._sheets/RoleInformation/local_roles_group_id_property.xml
+0
-59
product/ERP5/tests/testBusinessTemplate.py
product/ERP5/tests/testBusinessTemplate.py
+8
-2
product/ERP5Catalog/tests/testERP5CatalogSecurityUidOptimization.py
...P5Catalog/tests/testERP5CatalogSecurityUidOptimization.py
+7
-1
product/ERP5Security/tests/testERP5Security.py
product/ERP5Security/tests/testERP5Security.py
+5
-1
product/ERP5Type/ERP5Type.py
product/ERP5Type/ERP5Type.py
+8
-1
No files found.
product/ERP5/Document/BusinessTemplate.py
View file @
88e9c81e
...
...
@@ -3047,7 +3047,7 @@ class PortalTypeRolesTemplateItem(BaseTemplateItem):
k
=
k
[
5
:]
elif
k
==
'role_name'
:
k
,
v
=
'id'
,
'; '
.
join
(
v
)
elif
k
not
in
(
'title'
,
'description'
):
elif
k
not
in
(
'title'
,
'description'
,
'categories'
):
k
=
{
'id'
:
'object_id'
,
# for stable sort
'role_base_category'
:
'base_category'
,
'role_base_category_script_id'
:
'base_category_script'
,
...
...
@@ -3067,7 +3067,7 @@ class PortalTypeRolesTemplateItem(BaseTemplateItem):
xml_data
+=
"
\
n
<role id='%s'>"
%
role
[
'id'
]
# uniq
for
property
in
(
'title'
,
'description'
,
'condition'
,
'base_category_script'
,
'local_roles_group_id'
):
'base_category_script'
):
prop_value
=
role
.
get
(
property
)
if
prop_value
:
if
isinstance
(
prop_value
,
str
):
...
...
@@ -3075,7 +3075,7 @@ class PortalTypeRolesTemplateItem(BaseTemplateItem):
xml_data
+=
"
\
n
<property id='%s'>%s</property>"
%
\
(
property
,
prop_value
)
# multi
for
property
in
(
'category'
,
'base_category'
):
for
property
in
(
'categor
ies'
,
'categor
y'
,
'base_category'
):
for
prop_value
in
role
.
get
(
property
,
[]):
if
isinstance
(
prop_value
,
str
):
prop_value
=
prop_value
.
decode
(
'utf-8'
)
...
...
product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/RoleInformation/local_roles_group_id_property.xml
deleted
100644 → 0
View file @
88d54087
<?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>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
local_roles_group_id_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>
property_default
</string>
</key>
<value>
<string>
python: \'\'
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5/tests/testBusinessTemplate.py
View file @
88e9c81e
...
...
@@ -6537,6 +6537,11 @@ class TestBusinessTemplate(BusinessTemplateMixin):
' | security_uid'
,
'Alternate | alternate_security_uid'
,
)
# add category
self
.
portal
.
portal_categories
.
local_role_group
.
newContent
(
portal_type
=
'Category'
,
reference
=
'Alternate'
,
id
=
'Alternate'
)
types_tool
=
self
.
portal
.
portal_types
object_type
=
types_tool
.
newContent
(
'Geek Object'
,
'Base Type'
,
...
...
@@ -6558,7 +6563,7 @@ class TestBusinessTemplate(BusinessTemplateMixin):
self
.
tic
()
object_type
.
newContent
(
portal_type
=
'Role Information'
,
local_role
s_group_id
=
'Alternate'
,
local_role
_group_value
=
self
.
portal
.
portal_categories
.
local_role_group
.
Alternate
.
getRelativeUrl
()
,
role_name_list
=
(
'Assignee'
,
))
bt
=
self
.
portal
.
portal_templates
.
newContent
(
...
...
@@ -6588,7 +6593,8 @@ class TestBusinessTemplate(BusinessTemplateMixin):
new_bt
.
install
()
try
:
role
,
=
object_type
.
getRoleInformationList
()
self
.
assertEquals
(
'Alternate'
,
role
.
getLocalRolesGroupId
())
self
.
assertEquals
(
self
.
portal
.
portal_categories
.
local_role_group
.
Alternate
,
role
.
getLocalRoleGroupValue
())
path
=
self
.
portal
.
geek_module
[
'1'
]
self
.
assertEquals
([(
'group'
,
[
'Assignee'
],)],
[
item
for
item
in
path
.
__ac_local_roles__
.
items
()
if
item
[
1
]
!=
[
'Owner'
]])
...
...
product/ERP5Catalog/tests/testERP5CatalogSecurityUidOptimization.py
View file @
88e9c81e
...
...
@@ -98,6 +98,12 @@ CREATE TABLE alternate_roles_and_users (
' | security_uid'
,
'Alternate | alternate_security_uid'
,
)
# add category
self
.
portal
.
portal_categories
.
local_role_group
.
newContent
(
portal_type
=
'Category'
,
reference
=
'Alternate'
,
id
=
'Alternate'
)
# configure security on person, each user will be able to see his own
# person thanks to an Auditor role on "Alternate" local roles group id.
self
.
portal
.
portal_types
.
Person
.
newContent
(
...
...
@@ -105,7 +111,7 @@ CREATE TABLE alternate_roles_and_users (
role_name
=
'Auditor'
,
role_base_category_script_id
=
'ERP5Type_getSecurityCategoryFromSelf'
,
role_base_category
=
'agent'
,
local_role
s_group_id
=
'Alternate'
)
local_role
_group_value
=
self
.
portal
.
portal_categories
.
local_role_group
.
Alternate
.
getRelativeUrl
()
)
self
.
portal
.
portal_caches
.
clearAllCache
()
self
.
tic
()
...
...
product/ERP5Security/tests/testERP5Security.py
View file @
88e9c81e
...
...
@@ -574,9 +574,13 @@ class TestLocalRoleManagement(ERP5TypeTestCase):
def
testLocalRolesGroupId
(
self
):
"""Assigning a role with local roles group id.
"""
self
.
portal
.
portal_categories
.
local_role_group
.
newContent
(
portal_type
=
'Category'
,
reference
=
'Alternate'
,
id
=
'Alternate'
)
self
.
_getTypeInfo
().
newContent
(
portal_type
=
'Role Information'
,
role_name
=
'Assignor'
,
local_role
s_group_id
=
'Alternate'
,
local_role
_group_value
=
self
.
portal
.
portal_categories
.
local_role_group
.
Alternate
.
getRelativeUrl
(),
role_category
=
self
.
defined_category
)
self
.
loginAsUser
(
self
.
username
)
...
...
product/ERP5Type/ERP5Type.py
View file @
88e9c81e
...
...
@@ -93,7 +93,14 @@ class LocalRoleAssignorMixIn(object):
local_roles_group_id_group_id
=
{}
# Merge results from applicable roles
for
role_generator
in
self
.
getFilteredRoleListFor
(
ob
):
local_roles_group_id
=
role_generator
.
getProperty
(
'local_roles_group_id'
,
''
)
local_roles_group_id
=
''
if
getattr
(
role_generator
,
'getLocalRoleGroupValue'
,
None
)
is
not
None
:
# only some role generators like 'Role Information' support it
local_role_group
=
role_generator
.
getLocalRoleGroupValue
()
if
local_role_group
is
not
None
:
# role definitions use category to classify different types of local roles
# so use their categories' reference
local_roles_group_id
=
local_role_group
.
getReference
()
or
local_role_group
.
getId
()
for
group_id
,
role_list
\
in
role_generator
.
getLocalRolesFor
(
ob
,
user_name
).
iteritems
():
group_id_role_dict
.
setdefault
(
group_id
,
set
()).
update
(
role_list
)
...
...
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