Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message for unauthorized label of new annotation #924

Open
mzur opened this issue Sep 18, 2024 · 0 comments
Open

Improve error message for unauthorized label of new annotation #924

mzur opened this issue Sep 18, 2024 · 0 comments

Comments

@mzur
Copy link
Member

mzur commented Sep 18, 2024

// Label must belong to a label tree that is used by one of the projects.
&& DB::table('label_tree_project')
->whereIn('project_id', $projectIds)
->where('label_tree_id', $label->label_tree_id)
->exists();

The policy checks if a label intended for a new annotation belongs to a label tree that is attached to the project(s) of the file. If this is not the case, the user now just receives a cryptic "unauthorized" response. This should be improved with a more helpful error message. Use Response::deny() for this with the message: "You are not authorized to use label xxx because the label tree is not attached to the project."

Maybe we should look through the other policies if there are other places where we could improve error messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Medium Priority
Development

No branches or pull requests

1 participant