Project

General

Profile

Actions

Bug #20120

closed

Poor logging of 403 - forbidden responses

Added by Tomáš Strachota over 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Category:
Hammer core
Target version:
Difficulty:
Triaged:
Team Backlog:
Fixed in Releases:
Found in Releases:
In Kanboard:

Description

When user has insufficient permissions for some action and the foreman replies 403, hammer prints quite a poor message without telling the user what permissions are required (even though server provides such info).

# With user without "View hosts" permissions:
> hammer -u test host list
Forbidden - server refused to process the request

The response from the server:

[ERROR 2017-06-27T11:15:48 API] 403 Forbidden
[DEBUG 2017-06-27T11:15:48 API] {
    "error" => {
        "message" => "Access denied",
        "details" => "Missing one of the required permissions: view_hosts" 
    }
}
[DEBUG 2017-06-27T11:15:48 Exception] Using exception handler HammerCLIForeman::ExceptionHandler#handle_forbidden
[ERROR 2017-06-27T11:15:48 Exception] Forbidden - server refused to process the request

Expected results:

> hammer -u test host list
Access denied
Missing one of the required permissions: view_hosts

Actions

Also available in: Atom PDF