-
Notifications
You must be signed in to change notification settings - Fork 0
Description
When searching the nosy list popup using roles, it will return status 403 and an error json message
if the user is not an admin.
By default roles requires admin rights. In this specific case, the json is:
{
"error": {
"status": 403,
"msg": "User does not have search permission on \"user.roles\""
}
}
Change classhelper.js to report the error message to the console.
The following diff does the trick:
@@ -1014,6 +1027,10 @@ class ClassHelper extends HTMLElement {
throw new Error("error parsing json from roundup rest api");
}
+ if (json.error) {
+ throw new Error(`Search error: ${json.error.msg}`)
+ }
+
const data = json.data;
const links = json.data["@links"];
I could report the status as well.
I'm not sure if I can add a message to the user to the error. Maybe something like:
err = new Error(`Search error: ${json.error.msg}`)
err.userMessage = `The error message said: ${json.error.msg}`
throw err
Then the top level error handler that generates the popup could see if there is a userMessage and add
it to the popup.
Not sure if notifying the user in the popup is worthwhile unless the user can use that info.
In this case, the user would submit a new search without using a Role.
However an error triggers fallback to the classic classhelper.
The same query using the classic classhelper returns a search result after removing properties that the
user doesn't have access to. So searching only with roles=user roles=admin roles=anything show all
users.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status