repo_group methods

create_repo_group

create_repo_group(apiuser, group_name, owner=<Optional:<OptionalAttr:apiuser>>, description=<Optional:''>, copy_permissions=<Optional:False>)

Creates a repository group.

  • If the repository group name contains “/”, repository group will be created inside a repository group or nested repository groups

    For example “foo/bar/group1” will create repository group called “group1” inside group “foo/bar”. You have to have permissions to access and write to the last repository group (“bar” in this example)

This command can only be run using an Authentication Token with at least permissions to create repository groups, or admin permissions to parent repository groups.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • group_name (str) – Set the repository group name.
  • description (str) – Set the repository group description.
  • owner (str) – Set the repository group owner.
  • copy_permissions

Example output:

id : <id_given_in_input>
result : {
    "msg": "Created new repo group `<repo_group_name>`"
    "repo_group": <repogroup_object>
}
error :  null

Example error output:

id : <id_given_in_input>
result : null
error :  {
  failed to create repo group `<repogroupid>`
}

delete_repo_group

delete_repo_group(apiuser, repogroupid)

Deletes a repository group.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repogroupid (str or int) – Set the name or ID of repository group to be deleted.

Example output:

id : <id_given_in_input>
result : {
  'msg': 'deleted repo group ID:<repogroupid> <repogroupname>'
  'repo_group': null
}
error :  null

Example error output:

id : <id_given_in_input>
result : null
error :  {
  "failed to delete repo group ID:<repogroupid> <repogroupname>"
}

get_repo_group

get_repo_group(apiuser, repogroupid)

Return the specified repository group, along with permissions, and repositories inside the group

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repogroupid (str or int) – Specify the name of ID of the repository group.

Example output:

{
  "error": null,
  "id": repo-group-id,
  "result": {
    "group_description": "repo group description",
    "group_id": 14,
    "group_name": "group name",
    "permissions": [
      {
        "name": "super-admin-username",
        "origin": "super-admin",
        "permission": "group.admin",
        "type": "user"
      },
      {
        "name": "owner-name",
        "origin": "owner",
        "permission": "group.admin",
        "type": "user"
      },
      {
        "name": "user-group-name",
        "origin": "permission",
        "permission": "group.write",
        "type": "user_group"
      }
    ],
    "owner": "owner-name",
    "parent_group": null,
    "repositories": [ repo-list ]
  }
}

get_repo_groups

get_repo_groups(apiuser)

Returns all repository groups.

Parameters:apiuser (AuthUser) – This is filled automatically from the Authentication Token.

grant_user_group_permission_to_repo_group

grant_user_group_permission_to_repo_group(apiuser, repogroupid, usergroupid, perm, apply_to_children=<Optional:'none'>)

Grant permission for a user group on given repository group, or update existing permissions if found.

This command can only be run using an Authentication Token with admin permissions on the repository group.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repogroupid (str or int) – Set the name or id of repository group
  • usergroupid (str or int) – id of usergroup
  • perm (str) – (group.(none|read|write|admin))
  • apply_to_children (str) – ‘none’, ‘repos’, ‘groups’, ‘all’

Example output:

id : <id_given_in_input>
result : {
  "msg" : "Granted perm: `<perm>` (recursive:<apply_to_children>) for user group: `<usersgroupname>` in repo group: `<repo_group_name>`",
  "success": true

}
error :  null

Example error output:

id : <id_given_in_input>
result : null
error :  {
  "failed to edit permission for user group: `<usergroup>` in repo group: `<repo_group_name>`"
}

grant_user_permission_to_repo_group

grant_user_permission_to_repo_group(apiuser, repogroupid, userid, perm, apply_to_children=<Optional:'none'>)

Grant permission for a user on the given repository group, or update existing permissions if found.

This command can only be run using an Authentication Token with admin permissions.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repogroupid (str or int) – Set the name or ID of repository group.
  • userid (str) – Set the user name.
  • perm (str) – (group.(none|read|write|admin))
  • apply_to_children (str) – ‘none’, ‘repos’, ‘groups’, ‘all’

Example output:

id : <id_given_in_input>
result: {
          "msg" : "Granted perm: `<perm>` (recursive:<apply_to_children>) for user: `<username>` in repo group: `<repo_group_name>`",
          "success": true
        }
error:  null

Example error output:

id : <id_given_in_input>
result : null
error :  {
  "failed to edit permission for user: `<userid>` in repo group: `<repo_group_name>`"
}

revoke_user_group_permission_from_repo_group

revoke_user_group_permission_from_repo_group(apiuser, repogroupid, usergroupid, apply_to_children=<Optional:'none'>)

Revoke permission for user group on given repository.

This command can only be run using an Authentication Token with admin permissions on the repository group.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repogroupid (str or int) – name or id of repository group
  • usergroupid
  • apply_to_children (str) – ‘none’, ‘repos’, ‘groups’, ‘all’

Example output:

id : <id_given_in_input>
result: {
          "msg" : "Revoked perm (recursive:<apply_to_children>) for user group: `<usersgroupname>` in repo group: `<repo_group_name>`",
          "success": true
        }
error:  null

Example error output:

id : <id_given_in_input>
result : null
error :  {
  "failed to edit permission for user group: `<usergroup>` in repo group: `<repo_group_name>`"
}

revoke_user_permission_from_repo_group

revoke_user_permission_from_repo_group(apiuser, repogroupid, userid, apply_to_children=<Optional:'none'>)

Revoke permission for a user in a given repository group.

This command can only be run using an Authentication Token with admin permissions on the repository group.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repogroupid (str or int) – Set the name or ID of the repository group.
  • userid (str) – Set the user name to revoke.
  • apply_to_children (str) – ‘none’, ‘repos’, ‘groups’, ‘all’

Example output:

id : <id_given_in_input>
result: {
          "msg" : "Revoked perm (recursive:<apply_to_children>) for user: `<username>` in repo group: `<repo_group_name>`",
          "success": true
        }
error:  null

Example error output:

id : <id_given_in_input>
result : null
error :  {
  "failed to edit permission for user: `<userid>` in repo group: `<repo_group_name>`"
}

update_repo_group

update_repo_group(apiuser, repogroupid, group_name=<Optional:''>, description=<Optional:''>, owner=<Optional:<OptionalAttr:apiuser>>, enable_locking=<Optional:False>)

Updates repository group with the details given.

This command can only be run using an Authentication Token with admin permissions.

  • If the group_name name contains “/”, repository group will be updated accordingly with a repository group or nested repository groups

    For example repogroupid=group-test group_name=”foo/bar/group-test” will update repository group called “group-test” and place it inside group “foo/bar”. You have to have permissions to access and write to the last repository group (“bar” in this example)

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repogroupid (str or int) – Set the ID of repository group.
  • group_name (str) – Set the name of the repository group.
  • description (str) – Set a description for the group.
  • owner (str) – Set the repository group owner.
  • enable_locking (bool) – Enable repository locking. The default is false.