st2common/st2common/rbac/utils.py
def user_has_rule_action_permission(user_db, action_ref):
    """
    Check that the currently logged-in has necessary permissions on the action used / referenced
    inside the rule.
    """
    if not cfg.CONF.rbac.enable:
        return True

    action_db = action_utils.get_action_by_ref(ref=action_ref)
    action_resolver = resolvers.get_resolver_for_resource_type(ResourceType.ACTION)
    has_action_permission = action_resolver.user_has_resource_db_permission(
        user_db=user_db, resource_db=action_db, permission_type=PermissionType.ACTION_EXECUTE)

    if has_action_permission:
        return True

    return False

    Check that the currently logged-in has necessary permissions on the action used / referenced
    inside the rule.
    
Check that the currently logged-in has necessary permissions on the action used / referenced
inside the rule.
Check that the currently logged - in has necessary permissions on the action used / referenced inside the rule .
def user_has_rule_action_permission(user_db, action_ref):
    if not cfg.CONF.rbac.enable:
        return True
    action_db = action_utils.get_action_by_ref(ref=action_ref)
    action_resolver = resolvers.get_resolver_for_resource_type(ResourceType.ACTION)
    has_action_permission = action_resolver.user_has_resource_db_permission(
        user_db=user_db, resource_db=action_db, permission_type=PermissionType.ACTION_EXECUTE)
    if has_action_permission:
        return True
    return False
def user_has_rule_action_permission ( user_db , action_ref ) : if not cfg . CONF . rbac . enable : return True action_db = action_utils . get_action_by_ref ( ref = action_ref ) action_resolver = resolvers . get_resolver_for_resource_type ( ResourceType . ACTION ) has_action_permission = action_resolver . user_has_resource_db_permission ( user_db = user_db , resource_db = action_db , permission_type = PermissionType . ACTION_EXECUTE ) if has_action_permission : return True return False
Check that the currently logged-in has necessary permissions on the action used / referenced
inside the rule.
Check that the currently logged - in has necessary permissions on the action used / referenced inside the rule .
"""
    Check that the currently logged-in has necessary permissions on the action used / referenced
    inside the rule.
    """
user_db
action_ref