Access requests

Use ProjectAccessRequest and GroupAccessRequest objects to manipulate access requests for projects and groups. The gitlab.Gitlab.project_accessrequests, gitlab.Gitlab.group_accessrequests, Project.accessrequests and Group.accessrequests manager objects provide helper functions.

Examples

List access requests from projects and groups:

p_ars = gl.project_accessrequests.list(project_id=1)
g_ars = gl.group_accessrequests.list(group_id=1)
# or
p_ars = project.accessrequests.list()
g_ars = group.accessrequests.list()

Get a single request:

p_ar = gl.project_accessrequests.get(user_id, project_id=1)
g_ar = gl.group_accessrequests.get(user_id, group_id=1)
# or
p_ar = project.accessrequests.get(user_id)
g_ar = group.accessrequests.get(user_id)

Create an access request:

p_ar = gl.project_accessrequests.create({}, project_id=1)
g_ar = gl.group_accessrequests.create({}, group_id=1)
# or
p_ar = project.accessrequests.create({})
g_ar = group.accessrequests.create({})

Approve an access request:

ar.approve()  # defaults to DEVELOPER level
ar.approve(access_level=gitlab.MASTER_ACCESS)  # explicitly set access level

Deny (delete) an access request:

gl.project_accessrequests.delete(user_id, project_id=1)
gl.group_accessrequests.delete(user_id, group_id=1)
# or
project.accessrequests.delete(user_id)
group.accessrequests.delete(user_id)
# or
ar.delete()