def request_user_has_webhook_permission(permission_type):
 from st2common.models.db.webhook import WebhookDB
 def decorate(func):
  @wraps(func)
  def func_wrapper(*args, **kwargs):
   hook = '/'.join(args[1:])
   webhook_db = WebhookDB(name=hook)
   resource_db = webhook_db
   utils.assert_request_user_has_resource_db_permission(request=pecan.request, resource_db=resource_db, permission_type=permission_type)
   return func(*args, **kwargs)
  return func_wrapper
 return decorate

def request_user_has_webhook_permission ( permission_type ) : from st2common . models . db . webhook import WebhookDB def decorate ( func ) : @ wraps ( func ) def func_wrapper ( * args , ** kwargs ) : hook = '/' . join ( args [ 1 : ] ) webhook_db = WebhookDB ( name = hook ) resource_db = webhook_db utils . assert_request_user_has_resource_db_permission ( request = pecan . request , resource_db = resource_db , permission_type = permission_type ) return func ( * args , ** kwargs ) return func_wrapper return decorate
a decorator which checks that the currently logged-in user has a webhook post permission .