Alex Crowe bio photo

Alex Crowe

DevOps Engineer, London

Twitter LinkedIn Github

Changing GitLab Repository Access Rights

We love using GitLab at Pancentric, if you haven’t checked it out you really should. However one minor grip we’ve had is permissions.

By default only users who are owners on a project can create milestones and open/close all the issues present. This makes a lot of sense on projects which are available externally, but when you are dealing with trusted colleagues this just gets in the way of getting things done!

The assignment of permissions is cumulative so each level up gets all the permissions of the previous with some additions. These are defined in the app/models/ability.rb file.

Simply shuffling symbols about allow you to change what each level grants the user, in our case we move the :admin_issue and :admin_milestone from the project_master_rules into the project_report_rules method.

def project_report_rules
  project_guest_rules + [
    :download_code,
    :fork_project,
    :write_project_snippet,
    # moved these from project_master_rules role
    :modify_issue,
    :admin_issue,
    :admin_milestone
  ]
end

You can shuffle these to suit your own needs, but remember if you want to upgrade you’ll need to revert the change before you can pull newer versions of GitLab.

*note this is accurate as of GitLab 6.5, YMMV with other versions


comments powered by Disqus