more control on propagation of role permissions via option
This commit is contained in:
parent
2c548a3df6
commit
09b75367a7
1 changed files with 10 additions and 3 deletions
|
@ -151,7 +151,8 @@ class LoopsObjectSecuritySetter(BaseSecuritySetter):
|
||||||
for parent in self.parents:
|
for parent in self.parents:
|
||||||
if parent == self.baseObject:
|
if parent == self.baseObject:
|
||||||
continue
|
continue
|
||||||
if getOption(parent, 'security.no_propagate', checkType=False):
|
if getOption(parent, 'security.no_propagate_rolepermissions',
|
||||||
|
checkType=False):
|
||||||
continue
|
continue
|
||||||
secProvider = parent
|
secProvider = parent
|
||||||
wi = parent.workspaceInformation
|
wi = parent.workspaceInformation
|
||||||
|
@ -234,14 +235,20 @@ class ConceptSecuritySetter(LoopsObjectSecuritySetter):
|
||||||
|
|
||||||
adapts(IConceptSchema)
|
adapts(IConceptSchema)
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def noPropagateRolePermissions(self):
|
||||||
|
return getOption(self.baseObject, 'security.no_propagate_rolepermissions',
|
||||||
|
checkType=False)
|
||||||
|
|
||||||
def setAcquiredSecurity(self, relation, revert=False, updated=None):
|
def setAcquiredSecurity(self, relation, revert=False, updated=None):
|
||||||
if updated and relation.second in updated:
|
if updated and relation.second in updated:
|
||||||
return
|
return
|
||||||
if relation.predicate not in self.acquiringPredicates:
|
if relation.predicate not in self.acquiringPredicates:
|
||||||
return
|
return
|
||||||
setter = ISecuritySetter(adapted(relation.second))
|
setter = ISecuritySetter(adapted(relation.second))
|
||||||
setter.setDefaultRolePermissions()
|
if not self.noPropagateRolePermissions:
|
||||||
setter.acquireRolePermissions()
|
setter.setDefaultRolePermissions()
|
||||||
|
setter.acquireRolePermissions()
|
||||||
setter.acquirePrincipalRoles()
|
setter.acquirePrincipalRoles()
|
||||||
#wi = baseObject(self.context).workspaceInformation
|
#wi = baseObject(self.context).workspaceInformation
|
||||||
#if wi and not wi.propagateParentSecurity:
|
#if wi and not wi.propagateParentSecurity:
|
||||||
|
|
Loading…
Add table
Reference in a new issue