Adds a project member to a project

        :param user_id: user id
        :param access_level: access level, see gitlab help to know more
        :return: True if success
179609
def addgroupmember(self, group_id, user_id, access_level):
        
        if not isinstance(access_level, int):
            if access_level.lower() == 'owner':
                access_level = 50
            elif access_level.lower() == 'master':
                access_level = 40
            elif access_level.lower() == 'developer':
                access_level = 30
            elif access_level.lower() == 'reporter':
                access_level = 20
            elif access_level.lower() == 'guest':
                access_level = 10
            else:
                return False

        data = {'id': group_id, 'user_id': user_id, 'access_level': access_level}

        request = requests.post(
            '{0}/{1}/members'.format(self.groups_url, group_id),
            headers=self.headers, data=data, verify=self.verify_ssl, auth=self.auth, timeout=self.timeout)

        return request.status_code == 201
5431
def group_add_user_action(model, request):
    
    user_id = request.params.get('id')
    if not user_id:
        user_ids = request.params.getall('id[]')
    else:
        user_ids = [user_id]
    try:
        group = model.model
        validate_add_users_to_groups(model, user_ids, [group.id])
        for user_id in user_ids:
            group.add(user_id)
        group()
        model.parent.invalidate(group.name)
        localizer = get_localizer(request)
        message = localizer.translate(_(
            'added_user_to_group',
            default="Added user '${uid}' to group '${gid}'.",
            mapping={
                'uid': ', '.join(user_ids),
                'gid': group.id
            }
        ))
        return {
            'success': True,
            'message': message
        }
    except ManageMembershipError as e:
        if e.reason is not LM_TARGET_UID_NOT_ALLOWED:
            raise Exception(u"Unknown ManageMembershipError reason.")
        localizer = get_localizer(request)
        message = localizer.translate(_(
            'lm_add_target_uid_not_allowed',
            default=(
                "Failed adding user '${uid}' to group '${gid}'. "
                "Manage membership denied for user."
            ),
            mapping={
                'uid': e.data,
                'gid': group.id
            }
        ))
        return {
            'success': False,
            'message': message
        }
    except Exception as e:
        return {
            'success': False,
            'message': str(e)
        }
405219
def user_add_prj(self, *args, **kwargs):
        
        if not self.cur_user:
            return

        dialog = ProjectAdderDialog(user=self.cur_user)
        dialog.exec_()
        prjs = dialog.projects
        for prj in prjs:
            prjdata = djitemdata.ProjectItemData(prj)
            treemodel.TreeItem(prjdata, self.user_prj_model.root)
505909
@Deprecated
    public Membership addUserToProject(int projectId, int userId, Collection<Role> roles) throws RedmineException {
        return new Membership(transport)
                .setProject(new Project(transport).setId(projectId))
                .setUserId(userId)
                .addRoles(roles)
                .create();
    }
848667
def add_users_to_organization(self, organization_id, users_list):
        
        log.warning('Adding users...')
        url = 'rest/servicedeskapi/organization/{}/user'.format(organization_id)
        data = {'usernames': users_list}

        return self.post(url, headers=self.experimental_headers, data=data)
426840
public GitlabProject createUserProject(Integer userId, String name) throws IOException {
        return createUserProject(userId, name, null, null, null, null, null, null, null, null, null);
    }
239894
def __addUser(self, new_user):
        
        self.__lockReadAddUser.acquire()
        if new_user not in self.__cityUsers and \
                new_user not in self.__excludedUsers:
            self.__lockReadAddUser.release()
            self.__logger.debug("__addUser: Adding " + new_user)
            self.__cityUsers.add(new_user)

            myNewUser = GitHubUser(new_user)
            myNewUser.getData()
            myNewUser.getRealContributions()

            userLoc = myNewUser.location
            if not any(s in userLoc for s in self.__excludedLocations):
                self.__processedUsers.append(myNewUser)
        else:
            self.__logger.debug("__addUser: Excluding " + new_user)
            self.__lockReadAddUser.release()
248799
def add_user(self, ):
        
        i = self.user_tablev.currentIndex()
        item = i.internalPointer()
        if item:
            user = item.internal_data()
            if self._project:
                self._project.users.add(user)
            else:
                self._task.users.add(user)
            self.users.append(user)
            item.set_parent(None)
697659
public void addNegative(User user, AccessLevel accessLevel) {
        getAccessList().add(new Access(user, accessLevel, true));
    }
1315726
def add_to_public_members(self, public_member):
        
        assert isinstance(public_member, github.NamedUser.NamedUser), public_member
        headers, data = self._requester.requestJsonAndCheck(
            "PUT",
            self.url + "/public_members/" + public_member._identity
        )
445790
def get_projects_in_user(self, username):
        
        cmd = ["list", "assoc", "where", "user=%s" % username]
        results = self._read_output(cmd)

        project_list = []
        for result in results:
            project_list.append(result["Account"])
        return project_list
245136
public static void checkProjectAdmin(UserSession userSession, String organizationUuid, Optional<ProjectId> projectId) {
    userSession.checkLoggedIn();

    if (userSession.hasPermission(OrganizationPermission.ADMINISTER, organizationUuid)) {
      return;
    }

    if (projectId.isPresent()) {
      userSession.checkComponentUuidPermission(UserRole.ADMIN, projectId.get().getUuid());
    } else {
      throw insufficientPrivilegesException();
    }
  }
514187
public CompletableFuture<Revision> addPerUserPermission(Author author, String projectName,
                                                            String repoName, User member,
                                                            Collection<Permission> permission) {
        requireNonNull(author, "author");
        requireNonNull(projectName, "projectName");
        requireNonNull(repoName, "repoName");
        requireNonNull(member, "member");
        requireNonNull(permission, "permission");

        return getProject(projectName).thenCompose(project -> {
            ensureProjectMember(project, member);
            return addPermissionAtPointer(author, projectName,
                                          perUserPermissionPointer(repoName, member.id()), permission,
                                          "Add permission of '" + member.id() +
                                          "' as '" + permission + "' to the project " + projectName);
        });
    }
1007833
def add_membership(self, user, role):
        
        targetGroup = AuthGroup.objects(role=role, creator=self.client).first()
        if not targetGroup:
            return False

        target = AuthMembership.objects(user=user, creator=self.client).first()
        if not target:
            target = AuthMembership(user=user, creator=self.client)

        if not role in [i.role for i in target.groups]:
            target.groups.append(targetGroup)
            target.save()
        return True
425127
def add_user_to_group(self, username, groupname, raise_on_error=False):
        
        data = {
                'name': groupname,
        }
        response = self._post(self.rest_url + "/user/group/direct",
                              params={"username": username,},
                              data=json.dumps(data))

        if response.status_code == 201:
            return True

        if raise_on_error:
            raise RuntimeError(response.json()['message'])

        return False
854996
def add_member(self, user, permissions, api=None):
        
        api = api or self._API
        return AutomationMember.add(
            automation=self.id, user=user, permissions=permissions, api=api
        )
1190545
def addprojecthook(self, project_id, url, push=False, issues=False, merge_requests=False, tag_push=False):
        
        data = {
            'id': project_id,
            'url': url,
            'push_events': int(bool(push)),
            'issues_events': int(bool(issues)),
            'merge_requests_events': int(bool(merge_requests)),
            'tag_push_events': int(bool(tag_push)),
        }

        request = requests.post(
            '{0}/{1}/hooks'.format(self.projects_url, project_id),
            headers=self.headers, data=data, verify=self.verify_ssl, auth=self.auth, timeout=self.timeout)

        if request.status_code == 201:
            return request.json()
        else:
            return False