Access requests

Users can request access to groups and projects.

When access is granted the user should be given a numerical access level. The following constants are provided to represent the access levels:

  • gitlab.GUEST_ACCESS: 10
  • gitlab.REPORTER_ACCESS: 20
  • gitlab.DEVELOPER_ACCESS: 30
  • gitlab.MASTER_ACCESS: 40
  • gitlab.OWNER_ACCESS: 50

Examples

List access requests from projects and groups:

p_ars = project.accessrequests.list()
g_ars = group.accessrequests.list()

Get a single request:

p_ar = project.accessrequests.get(user_id)
g_ar = group.accessrequests.get(user_id)

Create an access request:

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:

project.accessrequests.delete(user_id)
group.accessrequests.delete(user_id)
# or
ar.delete()