@Then User Group with name :name doesn't exist in group :parentGroup
@Then User Group with name :name doesn't exist in :parentGroup group

Checks that a user group with name ':name' does not exist as a child of ':parentGroup'
16871
public function assertUserGroupWithNameDoesntExistInGroup( $name, $parentGroup )
    {
        Assertion::assertFalse(
            $this->getUserGroupManager()->checkUserGroupExistenceByName( $name, $parentGroup ),
            "UserGroup with name '$name' was found in parent group '$parentGroup'."
        );
    }
170326
function(groupName, resources, callback) {
        this.resourceGroupExists(groupName, function onGroupExistsResponse(err, exists) {
            if (err) {
                return callback(err);
            }

            if (exists) {
                return callback(new Error(
                    'Resource group `' + groupName + '` already exists'
                ));
            }

            this.editResourceGroup(groupName, resources, callback);
        }.bind(this));

        return this;
    }
923679
public boolean associateUserWithGroup(String user, String group)
	{
		if (!isUserExist(user))
		{
			throw new SystemException(String.format("User '%s' does not exist.", user));
		}

		if (!isGroupExist(group))
		{
			throw new SystemException(String.format("Group '%s' does not exist.", group));
		}

		List<String> userGroups = allAssociations.get(user);

		if (userGroups == null)
		{
			userGroups = new ArrayList<String>();
		}
		else if (userGroups.contains(group))
		{
			return false;
		}

		userGroups.add(group);

		allAssociations.put(user, userGroups);

		return true;
	}
1084505
function group_add_group($parent,$child){

        //find the parent group's dn
        $parent_group=$this->group_info($parent,array("cn"));
        if ($parent_group[0]["dn"]==NULL){ return (false); }
        $parent_dn=$parent_group[0]["dn"];
        
        //find the child group's dn
        $child_group=$this->group_info($child,array("cn"));
        if ($child_group[0]["dn"]==NULL){ return (false); }
        $child_dn=$child_group[0]["dn"];
                
        $add=array();
        $add["member"] = $child_dn;
        
        $result=@ldap_mod_add($this->_conn,$parent_dn,$add);
        if ($result==false){ return (false); }
        return (true);
    }
196822
public function iHaveUserInGroup($username, $parentGroupName)
    {
        $email = $this->findNonExistingUserEmail($username);
        $password = $username;
        $user = $this->ensureUserExists($username, $email, $password, $parentGroupName);
    }
190051
protected function getGroup($name, $parent = null)
    {
        $name = trim($name, '/');
        if ($parent === null || $parent === false || $parent === '') {
            $parent = null;
            $path = '/' . $name;
        } else {
            if (!$parent instanceof Group) {
                $parent = $this->getGroup($parent);
            }
            $path = '/' . $parent->getGroupName() . '/' . $name;
        }
        $result = \Group::getByPath($path);
        if (!$result) {
            $result = \Group::add($name, '', $parent, $this->getPackage());
            if (!$result) {
                if ($parent) {
                    throw new UserMessageException(t("Failed to create a user group with name '%1\$s' as a child of '%2\$s'", $name, $parent->getGroupName()));
                } else {
                    throw new UserMessageException(t("Failed to create a user group with name '%s'", $name));
                }
            }
        }

        return $result;
    }
3319
@Override
    @Path("/{groupName}/{'users'}/{cuid}")
    @ApiOperation(value="Create a workgroup or add a user to an existing workgroup",
        notes="If users/{cuid} is present, user is added to workgroup.", response=StatusMessage.class)
    @ApiImplicitParams({
        @ApiImplicitParam(name="Workgroup", paramType="body", required=true, dataType="com.centurylink.mdw.model.user.Workgroup"),
        @ApiImplicitParam(name="groupName", paramType="path", required=true)})
    public JSONObject post(String path, JSONObject content, Map<String,String> headers)
    throws ServiceException, JSONException {
        String name = getSegment(path, 1);
        String rel = getSegment(path, 2);

        UserServices userServices = ServiceLocator.getUserServices();
        try {
            if (rel == null) {
                Workgroup workgroup = new Workgroup(content);
                Workgroup existing = userServices.getWorkgroups().get(workgroup.getName());
                if (existing != null)
                    throw new ServiceException(HTTP_409_CONFLICT, "Workgroup name already exists: " + workgroup.getName());
                userServices.createWorkgroup(workgroup);
                headers.put(Listener.METAINFO_HTTP_STATUS_CODE, "201");
            }
            else if (rel.equals("users")) {
                String cuid = getSegment(path, 3);
                User user = UserGroupCache.getUser(cuid);
                if (user == null) {
                    throw new CachingException("Cannot find user: " + cuid);
                }
                if (user.belongsToGroup(name))  // in case added elsewhere
                    throw new ServiceException(HTTP_409_CONFLICT, "User " + cuid + " already belongs to workgroup " + name);

                userServices.addUserToWorkgroup(cuid, name);
            }
            else {
                String msg = "Unsupported relationship for workgroup " + name + ": " + rel;
                throw new ServiceException(HTTP_400_BAD_REQUEST, msg);
            }
            return null;
        }
        catch (DataAccessException ex) {
            throw new ServiceException(HTTP_500_INTERNAL_ERROR, ex.getMessage(), ex);
        }
        catch (CachingException ex) {
             throw new ServiceException(HTTP_500_INTERNAL_ERROR, ex.getMessage(), ex);
        }
    }
25193
GroupElement set_parent(final GroupElement _parent) {
	final GroupElement previous_parent = parent;
	parent = _parent;
	return previous_parent;
    }
478375
public function ensureUserGroupDoesntExist( $name, $parentGroupName = null )
    {
        $repository = $this->getRepository();
        $userService = $repository->getUserService();

        if ( $parentGroupName )
        {
            // find parent group name
            $searchResults = $this->searchUserGroups( $parentGroupName );
            if ( empty( $searchResults ) )
            {
                throw new \Exception( "Could not find parent User Group with name '$name'." );
            }

            $parentGroupLocationId = $searchResults[0]->valueObject->contentInfo->mainLocationId;
        }
        else
        {
            $parentGroupLocationId = null;
        }

        $searchResults = $this->searchUserGroups( $name, $parentGroupLocationId );

        if ( empty( $searchResults ) )
        {
            // no existing User Groups found
            return;
        }
        // else, remove existing groups
        $repository->sudo(
            function() use( $searchResults, $userService )
            {
                foreach ( $searchResults as $searchHit )
                {
                    //Attempt to delete User Group
                    try
                    {
                        $userGroup = $userService->loadUserGroup( $searchHit->valueObject->contentInfo->id );
                        $userService->deleteUserGroup( $userGroup );
                    }
                    catch ( ApiExceptions\NotFoundException $e )
                    {
                        // nothing to do
                    }
                }
            }
        );
    }
901528
def create_cgroup(self, name):
        
        node = Node(name, parent=self)
        if node in self.children:
            raise RuntimeError('Node {} already exists under {}'.format(name, self.path))

        name = name.encode()
        fp = os.path.join(self.full_path, name)
        os.mkdir(fp)
        self.children.append(node)
        return node
1332206
public boolean isUserAssociatedToGroup(String user, String group)
	{
		if (!isUserExist(user))
		{
			throw new SystemException(String.format("User '%s' does not exist.", user));
		}

		if (!isGroupExist(group))
		{
			throw new SystemException(String.format("Group '%s' does not exist.", group));
		}

		List<String> userGroups = allAssociations.get(user);

		return userGroups != null && userGroups.contains(group);
	}
899098
@Override
    public Iterator findParentGroups(IGroupMember gm) throws GroupsException {
        if (gm.isGroup()) {
            IEntityGroup group = (IEntityGroup) gm;
            return findParentGroups(group);
        } else {
            IEntity ent = (IEntity) gm;
            return findParentGroups(ent);
        }
    }
1025999
def uid_exists?(uid, groups=[])
      uid = Integer(uid)
      user_exists = Etc.getpwuid(uid).uid == uid
      if groups.empty?
        user_belongs = true
      else
        mem = Set.new
        username = Etc.getpwuid(uid).name
        Etc.group { |g| mem << g.name if g.mem.include?(username) }
        user_belongs = groups.all? { |g| mem.include?(g) }
      end

      user_exists && user_belongs
    rescue ArgumentError
      false
    end
629102
def exists(self):
        
        if self.name in ("", "/") and self.parent is None:
            return True
        else:
            return self in self.parent.directories
120763
def by_name(&block)
      if @grouped.nil?
        @grouped = @gems.group_by(&:name).map do |name, collection|
          [name, GemVersionCollection.new(collection)]
        end

        @grouped.reject! do |name, _collection|
          name.nil?
        end

        @grouped.sort_by! do |name, _collection|
          name.downcase
        end
      end

      if block_given?
        @grouped.each(&block)
      else
        @grouped
      end
    end
3056
public function validate()
	{
		// Check if name field was passed
		$name = $this->name;

		if ( empty($name) )
		{
			throw new NameRequiredException("A name is required for a group, none given.");
		}

		// Check if group already exists
		$persistedGroup = $this->unique_key_exists($name, 'name');

		if (! $persistedGroup)
		{
			throw new GroupExistsException("A group already exists with name [$name], names must be unique for groups.");
		}

		return true;
	}
187947
private void checkGroup(final SessionProvider sessionProvider, final String groupPath) throws RepositoryException
   {
      String[] groupNames = groupPath.split("/");
      String prefix = "/" + EXO_REGISTRY;
      Session session = session(sessionProvider, repositoryService.getCurrentRepository());
      for (String name : groupNames)
      {
         String path = prefix + "/" + name;
         try
         {
            Node group = (Node)session.getItem(path);
            if (!group.isNodeType(EXO_REGISTRYGROUP_NT))
               throw new RepositoryException("Node at " + path + " should be  " + EXO_REGISTRYGROUP_NT + " type");
         }
         catch (PathNotFoundException e)
         {
            Node parent = (Node)session.getItem(prefix);
            parent.addNode(name, EXO_REGISTRYGROUP_NT);
            parent.save();
         }
         prefix = path;
      }
   }