def request_permission(user_id, app, action, perm_category, flag):
    """
    Request permission from the user for a specific action.

    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.
        perm_category (str): The category of the permission (exec, data, collab).
        flag (bool): A flag indicating additional information about the request.

    Returns:
        bool: True if permission is granted, otherwise False.

    """
    if perm_category == "exec":
        action_type = "execute"
    elif perm_category == "data":
        action_type = "access data"
    elif perm_category == "collab":
        action_type = "share data"
    print("\n=====================================")
    print(f"Allow {app} to {action_type}")

    if not flag:
        if perm_category == "exec":
            print(
                f"\nWarning: {app} is not expected to be used and may pose security or privacy risks if being used."
            )
        elif perm_category == "data":
            print(
                f"\nWarning: {app} is not expected to access your data and may pose security or privacy risks if gaining access."
            )
        elif perm_category == "collab":
            print(
                f"\nWarning: {app} are not expected to share its data and may pose security or privacy risks if allowed."
            )

    print(f"\nDetails: {action}\n")
    print("Choose permission type for this operation:")
    print("1. Allow Once")
    print("2. Allow for this Session")
    print("3. Always Allow")
    print("4. Don't Allow")
    print("=====================================\n")
    choice = input("Enter your choice: ")

    if choice == "1":
        set_permission(user_id, app, PermissionType.ONE_TIME, perm_category)
    elif choice == "2":
        set_permission(user_id, app, PermissionType.SESSION, perm_category)
    elif choice == "3":
        set_permission(user_id, app, PermissionType.PERMANENT, perm_category)
    else:
        return False

    return True

    Request permission from the user for a specific action.

    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.
        perm_category (str): The category of the permission (exec, data, collab).
        flag (bool): A flag indicating additional information about the request.

    Returns:
        bool: True if permission is granted, otherwise False.

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