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

403 on function assign_user_group_to_project() #189

Open
Coulicoula opened this issue Jul 30, 2021 · 0 comments
Open

403 on function assign_user_group_to_project() #189

Coulicoula opened this issue Jul 30, 2021 · 0 comments
Labels
HubInstance Issues relating to blackduck.HubInstance

Comments

@Coulicoula
Copy link

Hi Black Duck Team

When using the assign_user_group_to_project() function, a user [with Project Manager rights - i.e default role as project creator] cannot add groups with roles within its own project. The reason why is because, you are not using the same endpoint when project roles have to be assigned or not:

  1. If you do not provide roles to the function assign_user_group_to_project(), you use the projects endpoint (https://SERVER/api/projects/PROJECT_HASH/roles)

It will work in any case because project creator try to access is own project. OK.

  1. However, if you provide roles (a role list or whatever), you use the usergroups endpoint (https://SERVER/api/usergroups/USERGROUP_HASH/roles)

It will not work if the user don't have the global role to access the usergroups endpoint. NOK

If the user don't have enough privileges, he will not be able to access this group endpoint, and the function return a 403 error, due to insufficient privileges.

I'm attaching to this issue a PR.
My proposal is to use in both cases the projects endpoint as it seems more natural in that situation.
Also, I've modified a json parameter that seemed to be outdated.
Regards,
Nicolas

@OffBy0x01 OffBy0x01 added the HubInstance Issues relating to blackduck.HubInstance label Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HubInstance Issues relating to blackduck.HubInstance
Projects
None yet
Development

No branches or pull requests

2 participants