def user_is_context_owner(context, owner_id=None): """Test if current user is the context owner e.g. to check if someone manipulating the context object is other than the owner of the object. Assimption: context is IOwned. A delegate is considered to be an owner of the object. """ if owner_id: return model_utils.is_current_or_delegated_user(owner_id) return model_utils.is_current_or_delegated_user(context.owner_id)
def user_is_context_owner(context): """Test if current user is the context owner e.g. to check if someone manipulating the context object is other than the owner of the object. A delegate is considered to be an owner of the object """ owner = utils.get_owner_pi(context) return model_utils.is_current_or_delegated_user(owner)
def user_is_context_owner(context): """Test if current user is the context owner e.g. to check if someone manipulating the context object is other than the owner of the object. Assumption: context is IOwned. A delegate is considered to be an owner of the object. """ user = _determine_related_user(context, user_attr_name="owner") return is_current_or_delegated_user(user)