Return 401 when action is not authorized

When a user is not authorized to access to something is the API,
this one return 401 instead of 400 now.

Fixes bug #1232045

(cherry picked from commit b2df5f9013f6d30097d5841027a759af0e9c8002)

Change-Id: I37ef87f79cd55e095132e0865cbaa324cd76323c
Merge "Return 401 when action is not authorized" into milestone-proposed