A permission scheme is a collection of permission grants. A permission grant consists of a holder and a permission.
The holder object contains information about the user or group being granted the permission. For example, the Administer projects permission is granted to a group named Teams in space administrators. In this case, the type is "type": "group", and the parameter is the group name, "parameter": "Teams in space administrators". The holder object is defined by the following properties:
type Identifies the user or group (see the list of types below).
parameter The value of this property depends on the type. For example, if the type is a group, then you need to specify the group name.
The following types are available. The expected values for the parameter are given in parenthesis (some types may not have a parameter):
name
description
name
description
name
description
name
description
name
description
name
description
name
description
name
description
name
description
name
description
name
description
name
description
Get all permission schemes
GET /rest/api/{2-3}/permissionscheme
Returns all permission schemes.
package main
import (
"context"
_ "github.com/ctreminiom/go-atlassian/v2/jira/v3"
"github.com/ctreminiom/go-atlassian/v2/jira/v2"
"log"
"os"
)
func main() {
/*
----------- Set an environment variable in git bash -----------
export HOST="https://ctreminiom.atlassian.net/"
export MAIL="MAIL_ADDRESS"
export TOKEN="TOKEN_API"
Docs: https://stackoverflow.com/questions/34169721/set-an-environment-variable-in-git-bash
*/
var (
host = os.Getenv("HOST")
mail = os.Getenv("MAIL")
token = os.Getenv("TOKEN")
)
atlassian, err := v2.New(nil, host)
if err != nil {
log.Fatal(err)
}
atlassian.Auth.SetBasicAuth(mail, token)
permissionSchemes, response, err := atlassian.Permission.Scheme.Gets(context.Background())
if err != nil {
log.Fatal(err)
}
log.Println("HTTP Endpoint Used", response.Endpoint)
for _, permissionScheme := range permissionSchemes.PermissionSchemes {
log.Println(permissionScheme.ID, permissionScheme.Name)
}
}