Skip to content

Make available a list of User Permissions per Group and Project

Problem to solve

Its cumbersome to culminate a list of permissions for each user, across all groups and projects on their instance. Currently, there is no summary available to see this information and as a work around customers are using a script to generate the data view they need.

Solution

  • Add an export button ️ (generates the same type of report as the script below)
  • Use icon only buttons, and use the button text in the tooltip instead 💡
Current 🆕
Current Proposal

Example Output

Username Email Type Path Access Level Inherited memberships
root admin@example.com Group gitlab-org Owner gitlab-org/subgroup-one, gitlab-org/subgroup-one/gitlab-test

Technical Implementation

backend - 5

  1. Create Service to generate csv file
  2. Create api to download the resultant csv file

frontend - 1

  1. Add new icon for csv export
  2. Email template

Example scripts given to the customer

require 'csv'

csv_file_path = '/var/tmp/ldap_group_link_export.csv'

begin
  rows = [
    ["Group", "LDAP Group CN", "Access Level"],
    *(LdapGroupLink.includes(:group).map do |group_link|
      [
        group_link.group.name,
        group_link.cn,
        group_link.human_access
      ]
    end)
  ]
  CSV.open(csv_file_path, "wb") do |csv|
    rows.each { |row| csv << row }
  end
rescue Exception => e
  puts e.message
  puts e.backtrace.inspect
end

puts csv_file_path
require 'csv' 

csv_file_path = '/var/tmp/groups.csv'

begin
  rows = [
    ["Group", "Description"],
    *(Group.all.map do |group|
      [
        group.name,
        group.description
      ]
    end)
  ]
  CSV.open(csv_file_path, "wb") do |csv|
    rows.each { |row| csv << row }
  end
rescue Exception => e
  puts e.message
  puts e.backtrace.inspect
end

puts csv_file_path

Additional Information

Relevant Zendesk ticket: https://gitlab.zendesk.com/agent/tickets/30745

cc @JobV

Edited by Aishwarya Subramanian