Exemplo n.º 1
0
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)
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
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)
Exemplo n.º 4
0
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)
Exemplo n.º 5
0
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)
Exemplo n.º 6
0
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)