Recover the Default Group for the workspace

José Antonio Garcel Díaz February 24, 2023

Hello, these last days we have been playing with the bitbucket API to adjust it to our needs. One of them is to know the default permissions granted to a new member.

I noticed that members are added to the default group, so we can achieve that by checking that group permissions.

However, we are not being able to recover which one of the groups of the workspace is the one selected as default. We can see it on the Web though.

Is there any workaround to achieve this? Thank you,

1 answer

1 accepted

0 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 27, 2023

Hi @José Antonio Garcel Díaz!

I don't think that it's possible to get via API which group is the default one at the moment, I will double-check with the development team and I'll let you know.

Please keep in mind the following about the default group:

The default group is the group where a user gets added if they are invited to a repo by a non-admin of the workspace. For example:

  1. UserA is an admin of repo https://bitbucket.org/my-workspace/my-repo/, but not an admin of the workspace https://bitbucket.org/my-workspace
  2. UserA invites UserB to said repo, via Repository settings > User and group access and grants UserB write access to the repo
  3. UserB accepts the invitation
  4. UserB then gets added to the default group

Even if the default group doesn't have access to any repo, UserB will continue to have access to https://bitbucket.org/my-workspace/my-repo/ as they were granted explicit access to said repo.

You can use the following API endpoint to get all explicit user permissions for a given repository:

Or the following API endpoint to get the explicit user permission for a given user and repository:

The following API endpoints will return explicit group permissions for a given repository, and explicit group permission for a given group slug and repository respectively:

If you have any questions, please feel free to let me know.

Kind regards,
Theodora

José Antonio Garcel Díaz February 27, 2023

Hey @Theodora, I'm very grateful for getting your response, very clarificating. We were hopping to be able to recover the default goup though, so now we'll try to handle it in a different manner.

If you get an update on this from your Dev team I'll happy to know about.

 

Thanks again,

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 3, 2023

Hi @José Antonio Garcel Díaz!

I had an update from the development team and I'm afraid that there is no API endpoint that provides a workspace's default group at the moment.

I went ahead and created a feature request about this in our issue tracker:

Please make sure to vote (by selecting the Vote for this issue link) and comment on it to give it more weight and further express your interest. You can also add yourself as a watcher (by selecting the Start watching this issue link) if you'd like to get notified via email on updates. Implementation of features is done as per our policy here and any updates will be posted in the feature request.

In the meantime, we have an internal API endpoint that you can use to retrieve the default group:

https://bitbucket.org/api/internal/workspaces/<workspace-slug>/default-group

Example:

curl -u BB_Username:App_Passowrd -X GET https://bitbucket.org/api/internal/workspaces/<workspace-slug>/default-group

The App_Passowrd needs to have at least Account: Write permissions to access that.

Please keep in mind though that since this is an internal API endpoint, we don't guarantee its behavior.

If you have any questions, please feel free to let me know.

Kind regards,
Theodora

José Antonio Garcel Díaz March 3, 2023

Hey @Theodora. Just voted the issue!

We will try your workaround ASAP.

We really appreciated your support, thanks again.

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 3, 2023

You are very welcome @José Antonio Garcel Díaz, I'm glad to have helped!

Please feel free to reach out if you ever need anything else!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events