def get_user_consent(user_id, app, action, flag, perm_category="exec"):
    """
    Get user consent for a specific action, and set or check permissions.

    Args:
        user_id (str): The ID of the user.
        app (str): The name of the app.
        action (str): The action description for which permission is requested.
        flag (bool): A flag indicating additional information about the request.
        perm_category (str): The category of the permission (exec, data, collab).

    Returns:
        bool: True if user consent is granted, otherwise False.

    """
    permission_type = get_permission(user_id, app, perm_category)

    if perm_category == "exec":
        permission_obj = "Execution"
    elif perm_category == "data":
        permission_obj = "Data Access"
    elif perm_category == "collab":
        permission_obj = "Data Sharing"

    if not permission_type:
        if not request_permission(user_id, app, action, perm_category, flag):
            print(f"\n{permission_obj} Permission denied for {app}.\n")
            return False
        permission_type = get_permission(user_id, app, perm_category)

    if permission_type == PermissionType.ONE_TIME:
        print(f"\nOne-time {permission_obj} Permission granted for {app}.\n")
        set_permission(user_id, app, None, perm_category)  # Remove permission after use

    elif permission_type == PermissionType.SESSION:
        print(f"\nSession {permission_obj} Permission granted for {app}.\n")

    elif permission_type == PermissionType.PERMANENT:
        print(f"\nPermanent {permission_obj} Permission granted for {app}.\n")

    else:
        print(f"\n{permission_obj} Permission denied for {app}.\n")
        return False

    return True

    Get user consent for a specific action, and set or check permissions.

    Args:
        user_id (str): The ID of the user.
        app (str): The name of the app.
        action (str): The action description for which permission is requested.
        flag (bool): A flag indicating additional information about the request.
        perm_category (str): The category of the permission (exec, data, collab).

    Returns:
        bool: True if user consent is granted, otherwise False.

    
llama-index-packs/llama-index-packs-secgpt/llama_index/packs/secgpt/permission.py