from apps.core import permissions


class TagCreatePermission(permissions.BasePermission):
    """ permission to create tag """

    def has_permission(self, request, view):
        user_level_info = self.get_user_permissions(request, view)
        if 'tag_create' in user_level_info['permissions']:
            return True


class TagUpdatePermission(permissions.BasePermission):
    """ permission to update tag """

    def has_permission(self, request, view):
        user_level_info = self.get_user_permissions(request, view)
        if 'tag_update' in user_level_info['permissions']:
            return True


class TagTrashPermission(permissions.BasePermission):
    """ permission to trash tag """
    def has_permission(self, request, view):
        user_level_info = self.get_user_permissions(request, view)
        if 'tag_trash' in user_level_info['permissions']:
            return True


class TagDeletePermission(permissions.BasePermission):
    """ permission to delete trash """
    def has_permission(self, request, view):
        user_level_info = self.get_user_permissions(request, view)
        if 'tag_trash' in user_level_info['permissions']:
            return True
