@@ -100,6 +100,8 @@ From there, you can see the following actions:
- Added or removed users and groups from project approval groups ([introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/213603) in GitLab 13.2)
- Project CI/CD variable added, removed, or protected status changed ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/30857) in GitLab 13.4)
- User was approved via Admin Area ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/276250) in GitLab 13.6)
- Project access token was successfully created or revoked ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/230007) in GitLab 13.9)
- Failed attempt to create or revoke a project access token ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/230007) in GitLab 13.9)
Project events can also be accessed via the [Project Audit Events API](../api/audit_events.md#project-audit-events).
expect(AuditEvent.last.details[:custom_message]).toeq("Created project access token with id: #{response.payload[:access_token].user.id} with scopes: #{response.payload[:access_token].scopes}")
context'when project access token is unsuccessfully created'do
context'with inadequate permissions'do
beforedo
resource.add_developer(user)
end
it_behaves_like'audit event details'
it'logs the permission error message'do
subject
expect(AuditEvent.last.details[:custom_message]).toeq('Attempted to create project access token but failed with message: User does not have permission to create project access token')
expect(AuditEvent.last.details[:custom_message]).toeq('Attempted to create project access token but failed with message: Could not provision maintainer access to project access token')
context'when project access token is unsuccessfully revoked'do
context'when access token does not belong to this project'do
beforedo
resource.add_maintainer(user)
end
it_behaves_like'audit event details'
it'logs the find error message'do
subject
expect(AuditEvent.last.details[:custom_message]).tomatch(/Attempted to revoke project access token with id: \d+, but failed with message: Failed to find bot user/)
end
end
context'with inadequate permissions'do
beforedo
resource.add_developer(user)
resource.add_maintainer(resource_bot)
end
it_behaves_like'audit event details'
it'logs the permission error message'do
subject
expect(AuditEvent.last.details[:custom_message]).tomatch(/Attempted to revoke project access token with id: \d+, but failed with message: #{user.name} cannot delete #{access_token.user.name}/)