Returns the list of members in a workspace and their permission levels. Permission can be:
owner
collaborator
member
package main
import (
"context"
"fmt"
"github.com/ctreminiom/go-atlassian/bitbucket"
"log"
"os"
)
func main() {
token := os.Getenv("BITBUCKET_TOKEN")
instance, err := bitbucket.New(nil, "")
if err != nil {
log.Fatal(err)
}
instance.Auth.SetBearerToken(token)
instance.Auth.SetUserAgent("curl/7.54.0")
users, response, err := instance.Workspace.Permission.Members(context.TODO(), "ctreminiom", "permission=\"owner\"")
if err != nil {
log.Println(response.Endpoint)
log.Println(response.Bytes.String())
log.Fatal(err)
}
for _, user := range users.Values {
fmt.Println(user)
}
}
Gets all repository permissions in a workspace
GET /2.0/workspaces/{workspace}/permissions/repositories
Returns an object for each repository permission for all of a workspace's repositories.
Permissions returned are effective permissions: the highest level of permission the user has. This does not distinguish between direct and indirect (group) privileges.
Only users with admin permission for the team may access this resource. The permissions can be:
GET /2.0/workspaces/{workspace}/permissions/repositories/{repo_slug}
Returns an object for the repository permission of each user in the requested repository.
Permissions returned are effective permissions: the highest level of permission the user has. This does not distinguish between direct and indirect (group) privileges.
Only users with admin permission for the repository may access this resource, the permissions can be:
admin
write
read
q=permission>"read"
sort=user.display_name
Note that the query parameter values need to be URL escaped so that = would become %3D.