def has_permission(self, *args, **kwargs):
        """Decorator used to check permissions before to call resource manager method"""
        def wrapper(view):
            if getattr(view, '_has_permissions_decorator', False) is True:
                return view

            @wraps(view)
            @jsonapi_exception_formatter
            def decorated(*view_args, **view_kwargs):
                self.check_permissions(view, view_args, view_kwargs, *args, **kwargs)
                return view(*view_args, **view_kwargs)
            decorated._has_permissions_decorator = True
            return decorated
        return wrapper
def has_permission ( self , * args , ** kwargs ) : def wrapper ( view ) : if getattr ( view , '_has_permissions_decorator' , False ) is True : return view @ wraps ( view ) @ jsonapi_exception_formatter def decorated ( * view_args , ** view_kwargs ) : self . check_permissions ( view , view_args , view_kwargs , * args , ** kwargs ) return view ( * view_args , ** view_kwargs ) decorated . _has_permissions_decorator = True return decorated return wrapper
Decorator used to check permissions before to call resource manager method