set loops.Owner role on object creation; do not propagate Owner role to children/resources
This commit is contained in:
		
							parent
							
								
									2cee73672b
								
							
						
					
					
						commit
						0c8cc8a24e
					
				
					 2 changed files with 6 additions and 1 deletions
				
			
		|  | @ -167,6 +167,9 @@ def setDefaultSecurity(obj, event): | ||||||
|     aObj = adapted(obj) |     aObj = adapted(obj) | ||||||
|     setter = ISecuritySetter(aObj) |     setter = ISecuritySetter(aObj) | ||||||
|     setter.setDefaultSecurity() |     setter.setDefaultSecurity() | ||||||
|  |     principal = getCurrentPrincipal() | ||||||
|  |     if principal is not None: | ||||||
|  |         assignOwner(obj, principal.id) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @component.adapter(IConcept, IAssignmentEvent) | @component.adapter(IConcept, IAssignmentEvent) | ||||||
|  |  | ||||||
|  | @ -135,6 +135,7 @@ class LoopsObjectSecuritySetter(BaseSecuritySetter): | ||||||
|         prm = IPrincipalRoleMap(baseObject(source.context)) |         prm = IPrincipalRoleMap(baseObject(source.context)) | ||||||
|         for r, p, s in prm.getPrincipalsAndRoles(): |         for r, p, s in prm.getPrincipalsAndRoles(): | ||||||
|             #if p in self.workspacePrincipals: |             #if p in self.workspacePrincipals: | ||||||
|  |             if r != 'loops.Owner': | ||||||
|                 if revert: |                 if revert: | ||||||
|                     setPrincipalRole(self.principalRoleManager, r, p, Unset) |                     setPrincipalRole(self.principalRoleManager, r, p, Unset) | ||||||
|                 else: |                 else: | ||||||
|  | @ -203,7 +204,8 @@ class ResourceSecuritySetter(LoopsObjectSecuritySetter): | ||||||
|             vSetters = [ISecuritySetter(adapted(v)) for v in versions] |             vSetters = [ISecuritySetter(adapted(v)) for v in versions] | ||||||
|         prm = IPrincipalRoleMap(baseObject(source.context)) |         prm = IPrincipalRoleMap(baseObject(source.context)) | ||||||
|         for r, p, s in prm.getPrincipalsAndRoles(): |         for r, p, s in prm.getPrincipalsAndRoles(): | ||||||
|             if p in self.workspacePrincipals: |             #if p in self.workspacePrincipals: | ||||||
|  |             if r != 'loops.Owner' and p in self.workspacePrincipals: | ||||||
|                 for v in vSetters: |                 for v in vSetters: | ||||||
|                     if revert: |                     if revert: | ||||||
|                         setPrincipalRole(v.principalRoleManager, r, p, Unset) |                         setPrincipalRole(v.principalRoleManager, r, p, Unset) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue