src/pyams_security/security.py
changeset 114 d00688ea8124
parent 93 be0b2504aaf3
child 118 e29e9774400a
equal deleted inserted replaced
113:e8872cb2fb79 114:d00688ea8124
   198 
   198 
   199 ROLES_ANNOTATIONS_KEY = 'pyams_security.roles'
   199 ROLES_ANNOTATIONS_KEY = 'pyams_security.roles'
   200 
   200 
   201 
   201 
   202 @adapter_config(context=IDefaultProtectionPolicy, provides=IRoleProtectedObject)
   202 @adapter_config(context=IDefaultProtectionPolicy, provides=IRoleProtectedObject)
   203 def ProtectedObjectFactory(context):
   203 def protected_object_factory(context):
   204     """Default protected object factory"""
   204     """Default protected object factory"""
   205     annotations = IAnnotations(context)
   205     annotations = IAnnotations(context)
   206     protection = annotations.get(ROLES_ANNOTATIONS_KEY)
   206     protection = annotations.get(ROLES_ANNOTATIONS_KEY)
   207     if protection is None:
   207     if protection is None:
   208         protection = annotations[ROLES_ANNOTATIONS_KEY] = RoleProtectedObject()
   208         protection = annotations[ROLES_ANNOTATIONS_KEY] = RoleProtectedObject()