Open ghost opened 6 years ago
When setting roles using .manage_setLocalRoles, .reindexObjectSecurity needs to be called.
.manage_setLocalRoles
.reindexObjectSecurity
self.inbox = create(Builder('inbox')) self.inbox.manage_setLocalRoles('hugo.boss', ('Contributor', 'Editor', 'Reader')) self.inbox.reindexObjectSecurity()
It would be great if the builder had a method to build objects and automatically called .reindexObjectSecurity():
.reindexObjectSecurity()
self.inbox = create(Builder('inbox') .with_roles('hugo.boss', ('Contributor', 'Editor', 'Reader')))
An implementation could look something like this:
def with_roles(self, principle, roles): self.local_roles[principle] = roles return self def after_create(self, obj): if self.local_roles: self.set_roles(obj) .... def set_roles(self, obj): for principle, roles in self.local_roles: obj.manage_setLocalRoles(principle, roles) obj.reindexObjectSecurity()
When setting roles using
.manage_setLocalRoles
,.reindexObjectSecurity
needs to be called.It would be great if the builder had a method to build objects and automatically called
.reindexObjectSecurity()
:An implementation could look something like this: