How to prevent project maintainer add new members in GitLab? - gitlab

I want to disallow project maintainer to add new member only, and keep all other maintainer roles. How do I config this rule?
I have local Gitlab 11.9.x version.
I am Owner who create a private project and add new members to team.

You cannot. As the project maintainer, a user can always add new members. Check https://docs.gitlab.com/ee/user/permissions.html for a detailed list of permissions.

Could prevent maintainers from being able to add members to projects in a group
https://docs.gitlab.com/ee/user/group/access_and_permissions.html#prevent-members-from-being-added-to-projects-in-a-group

Related

How to add all users to a project, including new ones?

I would like to setup a sandbox project in my school GitLab server (self-hosted, free), that all users, especially new ones, can use to test whatever they need.
How can I add all users to the same project?
I already read this releated question (that asks the opposite), but it only partially help; the most useful answer tells me to use the API, which is good if I want to add all current users to a project, but I also want to add new ones.
Is there a way to add a user to a project, triggered by that user being confirmed?
One builtin method would be to use system hooks. For example, you can create a hook that responds to user_create events and adds the user to the project.
Another way may be just to run a scheduled CI pipeline that scripts this or similar automation (e.g. cron job on the server or whatever).
You can use the users list API to enumerate all current users in your GitLab instance (requires admin privileges). You can also use the project membership API to enumerate all members of the project. You can compare the two results to find any users that need to be added.
Pseudocode:
project_members = get_project_members(project_id=1234) # project members API
for user in get_all_gitlab_users(): # list users API
if user not in project_members:
add_project_member(user=user, project_id=1234)

Change role names in gitlab from master to maintainer

In some of our projects, we are moving away from 'master' branch to 'main' branch. I noticed in our project, we have a role called 'master', and I wanted to know how/if I can change it.
I see in the gitlab documentation that they no longer have a role called 'master', but it looks like it's equivalent is 'maintainer'. However, from within our gitlab organization help pages (from clicking 'Help' under my avatar at the top left), the role is referred to as 'Master'.
Can I change the role within our project? Or does that have to be done at the organization level?
Permissions and roles are statically defined in GitLab, as illustrated for instance by commit a63bce1, which did rename the Master role to Maintainer.
So unless you are modifying the sources from GitLab itself, or upgrading your on-premise GitLab to 13.x (since the change came during the 12.x releases serie), you would still see master instead of maintainer.

Best practice for supporting small/personal projects/repos on Azure DevOps (on premises)

I am setting up a on premises instance of Azure DevOps 2019 and have read over the guide for planning the organizational structure. In our situation, having a single organization and several projects and teams seems to be the most appropriate structure.
The question I have is in a situation where people have small utility programs they have written to help with their day to day tasks, where should I have them have place their code. In this situation, it may not pertain to a certain project and I feel like creating projects for every individual user that wants their own little playground to put code would be messy.
Is there a way I can have a project where users can have their own little area of repositories for their use and not see all other people's repositories in that project and therefore not look so cluttered?
Is there some better way to give users their own area to have repositories for their own use without cluttering up projects?
You can create a new project to place the repositories of the developers.
You change the repositories permission settings to achieve users can only view their own little area of repositories for their use and not see all other people's repositories in that project. See below:
1, Set the permission on All Repositories Level
Go to project settings of the project--> Repositories under Repos-->Permissions under All Repositories-->Search for the users in the search bar-->Change his permission to Not set or Deny
By denying this user's permission on the All repositories level, so that he willnot be able to see other people's repositories in that project
2, Set the permission on Single Repository Level
Go to project settings of the project--> Repositories under Repos-->Select the repository of this user-->Permissions tab-->Search for the user in the search box-->Set the permission to allow for the user his own repository(override the permission set on above All Repositories level).
By doing above two steps. Users will only be able to view their own repositories on the project portal.
I agree common code or small utilities should reside separately apart from project code base. You can make a new project like CommonScripts or any name then the user can create a separate repository and maintain there own code or utility.
Advantage of doing that other person or multiple project can access that common piece of library in pipeline if required without doing code redundancy.
As an example in our organization we have project name called DevOps then we have separate repositories accordingly.

gitlab giving users code download rights but no rights to see project

Is there a way in gitlab to disable a project from showing up as a project if the user only has guest level privileges?
To clarify and add a little more detail.
I have added the ability for guest to download code but removed pretty much every privellege regarding actually using gitlab to look at the project. Which means that if the project shows up as a project to the user and they click on it gitlab returns an error. I would much rather gitlab not show the project at if the user has guest level access.
We use git submodules in our projects and we need to be able to give people the ability to clone a repo and all it submodules without giving everyone access to browse and find every project that can be a submodule or making projects public.
Currently not. But feel fee to create a PR which add's this functionality

How to share group repository in GitLab 6.0.0

I just installed GitLab 6.0.0 and I am now trying to create a group in order to share a common repository with other users. So I created the group and then added the users I want as owners of this group.
The problem is that the group members don't seem to be able to choose the corresponding namespace when they creating a new project.
Is this a bug? or am I missing something?
Any help is welcomed, thanks.
Best regards,
Michael Pinheiro
It looks like this bug: issue 4900
workarounds:
I should also mention that if User B now creates a Group Y, he is now able to create projects for Group X and Y. (which is a simple workaround)
The other work-around is to have the user create the project in their personal namespace first, then when the repo is created go to settings -> dangerous settings -> change namespace option.
A patch should be proposed soon to fix that bug, which seems to be related to app/models/user.rb (lines 293-295 and lines 331-333)

Resources