3
6ßL]—  ã               @   s\   d dl mZmZmZmZmZ ddlmZ G dd„ deƒZG dd„ deƒZ	G dd	„ d	eƒZ
d
S )é    )ÚBoolÚ	HasTraitsÚPropertyÚStrÚUnicodeé   )Úget_permissions_managerc                   sL   e Zd ZdZeZeZeZ	e
dƒZe
dƒZ‡ fdd„Zdd„ Zdd	„ Z‡  ZS )
Ú
PermissionzºA permission is the link between an application action and the current
    user - if the user has a permission attached to the action then the user is
    allowed to perform that action.FTc                s$   t t| ƒjf |Ž tƒ jj| ƒ dS )zInitialise the object.N)Úsuperr	   Ú__init__r   Zpolicy_managerZregister_permission)ÚselfZtraits)Ú	__class__© úE/tmp/pip-install-5sebvq2j/apptools/apptools/permissions/permission.pyr   9   s    zPermission.__init__c             C   s   | j }|s| j}|S )z&Return a user friendly representation.)ÚdescriptionÚid)r   Úsr   r   r   Ú__str__A   s    zPermission.__str__c             C   s   t ƒ j| ƒS )z#Check the user has this permission.)r   Zcheck_permissions)r   r   r   r   Ú_get_grantedN   s    zPermission._get_granted)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   Zgrantedr   Ú	bootstrapZapplication_definedr   r   r   Ú__classcell__r   r   )r   r   r	      s   r	   c               @   s(   e Zd ZdZedƒZedƒZedƒZ	dS )ÚManagePolicyPermissionz:The standard permission for managing permissions policies.zets.permissions.manage_policyzManage permissions policyTN)
r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   T   s   r   c               @   s(   e Zd ZdZedƒZedƒZedƒZ	dS )ÚManageUsersPermissionz7The standard permission for managing permissions users.zets.permissions.manage_userszManage usersTN)
r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   `   s   r   N)Z
traits.apir   r   r   r   r   Zpackage_globalsr   r	   r   r   r   r   r   r   Ú<module>   s   =