def set_permission(user_id, app, permission_type, perm_category):
    """
    Set a specific permission for a user and app.

    Args:
        user_id (str): The ID of the user.
        app (str): The name of the app.
        permission_type (str): The type of permission (one-time, session, permanent).
        perm_category (str): The category of the permission (exec, data, collab).

    """
    permissions = read_permissions_from_file()
    permissions[user_id] = permissions.get(user_id, {})
    permissions[user_id][app] = permissions[user_id].get(app, {})
    permissions[user_id][app][perm_category] = permission_type
    write_permissions_to_file(permissions)

    Set a specific permission for a user and app.

    Args:
        user_id (str): The ID of the user.
        app (str): The name of the app.
        permission_type (str): The type of permission (one-time, session, permanent).
        perm_category (str): The category of the permission (exec, data, collab).

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