Remove a Generis User from persistent memory. Bound roles will remain

@access public
@author Jerome Bogaerts, <jerome@taotesting.com>
@param  Resource user A reference to the User to be removed from the persistent memory of Generis.
@return boolean
351065
public function removeUser( core_kernel_classes_Resource $user)
    {
        $returnValue = (bool) false;

        $returnValue = $user->delete();

        return (bool) $returnValue;
    }
536611
def _role_remove(name, user=None, host=None, port=None, maintenance_db=None,
                 password=None, runas=None):
    '''
    
    '''

    # check if user exists
    if not user_exists(name, user, host, port, maintenance_db,
                       password=password, runas=runas):
        log.info('User \'%s\' does not exist', name)
        return False

    # user exists, proceed
    sub_cmd = 'DROP ROLE "{0}"'.format(name)
    _psql_prepare_and_run(
        ['-c', sub_cmd],
        runas=runas, host=host, user=user, port=port,
        maintenance_db=maintenance_db, password=password)

    if not user_exists(name, user, host, port, maintenance_db,
                       password=password, runas=runas):
        return True
    else:
        log.info('Failed to delete user \'%s\'.', name)
        return False
344832
public function removeResource(Resource $resource)
    {
        if (!isset($this->resources[$resource->getUri()])) {
            return;
        }
        unset($this->resources[$resource->getUri()]);
    }
204799
def remove_role(*_, role_handle=None, user_id=None):
    
    click.echo(green('\nRemoving role from user:'))
    click.echo(green('-' * 40))
    with get_app().app_context():
        user = find_user(dict(id=user_id))
        if not user:
            click.echo(red('User not found\n'))
            return

        remove_role = None
        for role in user.roles:
            if role.handle == role_handle:
                remove_role = role

        if not remove_role:
            click.echo(red('User does not have such role\n'))
            return

        user_service.remove_role_from_user(user, remove_role)
        msg = 'Role "{}" removed from user "{}"\n'.format(
            remove_role.handle,
            user.email
        )
        click.echo(green(msg))
        return
77019
public function remove_user_from_group($user, $groupid) {
        global $DB;
        require_capability('moodle/course:managegroups', $this->context);
        $group = $this->get_group($groupid);
        if (!groups_remove_member_allowed($group, $user)) {
            return false;
        }
        if (!$group) {
            return false;
        }
        return groups_remove_member($group, $user);
    }
265633
public void removeMember(User user) {
        long userId = user.getId();
        members.remove(userId);
        nicknames.remove(userId);
        selfMuted.remove(userId);
        selfDeafened.remove(userId);
        muted.remove(userId);
        deafened.remove(userId);
        getRoles().forEach(role -> ((RoleImpl) role).removeUserFromCache(user));
        joinedAtTimestamps.remove(userId);
    }
63321
public function removeMyFriend(\CsnUser\Entity\User $user)
    {
        $user->removeFriendWithMe($this); // synchronously updating inverse side.
        $this->myFriends->removeElement($user);

        return $this;
    }
342673
public boolean deleteUser(String name)
	{
		if (ADMIN_USER_ID.equals(name))
		{
			throw new SystemException(String.format("Cannot delete '%s' user.", ADMIN_USER_ID));
		}

		if (!isUserExist(name))
		{
			throw new SystemException(String.format("User '%s' does not exist.", name));
		}

		allAssociations.remove(name);

		return allUsers.remove(name);
	}
232735
public function publicDelete($user, Event $event)
    {
        if ($event->creator->id == $user->id) {
            return User::findOrFail($user->id)->hasPermission('laralum::events.delete-public');
        }

        return false;
    }
1294420
public function deleteFavourite(User $user, ResourceNode $resourceNode)
    {
        $favourite = $this->repo->findOneBy(['user' => $user, 'resourceNode' => $resourceNode]);

        if (!empty($favourite)) {
            $this->om->remove($favourite);
            $this->om->flush();
        }
    }
592474
public boolean deleteUser(String userName) {
		// load user info from file
		if (resourcePath != null) {

			lock.writeLock().lock();
			try {
				File userDir = new File(resourcePath, "users");
				if (userDir.isDirectory()) {
					// get the file which corresponds to the user
					File userFile = new File(userDir.getAbsolutePath(), userName);
					return userFile.delete();
				}
			} finally {
				lock.writeLock().unlock();
			}
		} // end if resourcePath not null
		return false;
	}
701028
public function removeUser(User $user)
    {
        if ($this->users->contains($user)) {
            $this->users->removeElement($user);
        }

        return $this;
    }
15653
public function isAllowed($resource = null, $privilege = null)
    {
        if (is_array($privilege)) {
            foreach ($privilege as $privilegeSingular) {
                if ($this->isAllowed($resource, $privilegeSingular)) {
                    return true;
                }
            }
            return false;
        }
        try {
            $result = $this->getContextualAcl()->isAllowed($this->getContextId(), $resource, $privilege);
        } catch (InvalidArgumentException $e) {
            return false;
        }
        return $result;
    }
939131
public function destroy($user)
    {
        $user = User::find($user);
        if (!$user) {
            return redirect_to_resource();
        }

        $this->deleteEntry($user, request());

        return redirect_to_resource();
    }
668049
protected boolean remove(CmsResource resource) {

        // it is essential that this method is only visible within the db package!
        boolean ret = m_fileList.remove(resource);
        ret |= m_folderList.remove(resource);
        ret |= m_deletedFolderList.remove(resource);
        return ret;
    }
445550
public function unassign($role, UserInterface $user)
    {
        $roles = is_array($role) ? $role : [ $role ];

        $count = 0;

        foreach ($roles as $singleRole) {
            $count += $this->unassignSingleRole($singleRole, $user) ? 1 : 0;
        }

        if ($count !== count($roles)) {
            // @codeCoverageIgnoreStart
            return false;
            // @codeCoverageIgnoreEnd
        }

        $this->fireUserPermissionChangeEvent($user);
        return true;
    }
1309411
public ServerUpdater removeRolesFromUser(User user, Collection<Role> roles) {
        delegate.removeRolesFromUser(user, roles);
        return this;
    }