The following is a sample cURL command for creating a repository and build permission targets:
curl -uadmin:<password> -XPUT "https://localhost:8081/artifactory/api/v2/security/permissions/java-developers" -H "Content-type: application/json" -T build-info-permission.json
As featured in the cURL above, build-info-permission.json features the following three parameters:
- java-developers is the name of the permission target that will be created,
- generic-local is the name of a Generic-type, local repository, and
- testmaven is the name of an existing build in Artifactory
Following is a sample of a build-info-permission.json:
{ "name": "java-developers", "repo": { – "include-patterns": ["**"] (default), – "exclude-patterns": [""] (default), + "repositories": ["generic-local"], – "actions": { "users" : { "test1": ["read","write","manage"], "test2" : ["write","annotate", "read"] }, "groups" : { "group1" : ["manage","read","annotate"], "readers" : ["read"] } } }, "build": { – "include-patterns": ["testmaven/**"] (default), – "exclude-patterns": [""] (default), + "repositories": ["artifactory-build-info"] (default, can't be changed), – "actions": { "users" : { "test1": ["read","manage"], "test2" : ["write"] }, "groups" : { "group1" : ["manage","read","write","annotate","delete"], "readers" : ["read"] } } } }
More information about using the Create or Replace Permission Target REST API command is available HERE.
Published: May 21, 2019
Last updated: Apr. 23, 2021
Keywords: Artifactory build permissions, build permission targets