Remove userRole

@param \CanalTP\SamCoreBundle\Entity\Role $userRole
510409
public function removeUserRole(\CanalTP\SamCoreBundle\Entity\Role $userRole)
    {
        $this->userRoles->removeElement($userRole);
    }
323872
public function removeRoleAssignmentById($roleAssignmentId)
    {
        try {
            return $this->innerGateway->removeRoleAssignmentById($roleAssignmentId);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
273278
def delete_user_role(deleted_user_id, role_id,**kwargs):
    
    #check_perm(kwargs.get('user_id'), 'edit_role')
    try:
        _get_user(deleted_user_id)
        _get_role(role_id)
        roleuser_i = db.DBSession.query(RoleUser).filter(RoleUser.user_id==deleted_user_id, RoleUser.role_id==role_id).one()
        db.DBSession.delete(roleuser_i)
    except NoResultFound:
        raise ResourceNotFoundError("User Role does not exist")

    return 'OK'
1066663
public function prune($userRole = null)
    {
        if ($userRole) {
            $this->addCond('pruneCond0', $this->getAliasedColName(UserRoleTableMap::COL_USER_ID), $userRole->getUserId(), Criteria::NOT_EQUAL);
            $this->addCond('pruneCond1', $this->getAliasedColName(UserRoleTableMap::COL_ROLE_ID), $userRole->getRoleId(), Criteria::NOT_EQUAL);
            $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
        }

        return $this;
    }
368350
public function removeRole($role)
    {
        $roleElement = $this->getRole($role);
        if ($roleElement) {
            $this->roles->removeElement($roleElement);
        }

        return $this;
    }
120887
def remove_role_from_user(user, role):
    
    user = _query_to_user(user)
    role = _query_to_role(role)
    if click.confirm(f'Are you sure you want to remove {role!r} from {user!r}?'):
        user.roles.remove(role)
        user_manager.save(user, commit=True)
        click.echo(f'Successfully removed {role!r} from {user!r}')
    else:
        click.echo('Cancelled.')
1192377
public function removeGroupesRole(\Thibautg16\UtilisateurBundle\Entity\Groupe $groupesRole)
    {
        $this->groupes_role->removeElement($groupesRole);
    }
422987
public function detachRole($role)
    {
        if (is_object($role)) {
            $role = $role->getKey();
        }

        if (is_array($role)) {
            $role = $role['id'];
        }

        $this->roles()->detach($role);

        self::clearCache();
    }
133269
public function removeRole($roleName)
    {
        if (true === is_string($roleName) && true === in_array($roleName, $this->roles)) {
            foreach (array_keys($this->roles, (string)$roleName, true) as $key) {
                unset($this->roles[$key]);
            }
        }
        return $this;
    }
302579
public function delete()
	{
        if (!$this->isXmlHttpRequest()) {
            throw new common_exception_BadRequest('wrong request mode');
        } else {
			$deleted = false;
			if($this->getRequestParameter('uri')){

				$role = $this->getCurrentInstance();

				if(!in_array($role->getUri(), $this->forbidden)){
						//check if no user is using this role:
						$userClass = $this->getClass(GenerisRdf::CLASS_GENERIS_USER);
						$options = array('recursive' => true, 'like' => false);
						$filters = array(GenerisRdf::PROPERTY_USER_ROLES => $role->getUri());
						$users = $userClass->searchInstances($filters, $options);
						if(empty($users)){
							//delete role here:
							$deleted = $this->getClassService()->removeRole($role);
						}else{
							//set message error
							throw new UserErrorException(__('This role is still given to one or more users. Please remove the role to these users first.'));
						}
				}else{
					throw new UserErrorException($role->getLabel() . ' could not be deleted');
				}
			}

			$this->returnJson(array('deleted' => $deleted));
		}
	}
190248
public function removeUser(\CampaignChain\Location\FacebookBundle\Entity\User $users)
    {
        $this->users->removeElement($users);
    }
1364359
public function destroy(Role $role)
    {
        $role->delete();

        return intend([
            'url' => route('managerarea.roles.index'),
            'with' => ['warning' => trans('cortex/foundation::messages.resource_deleted', ['resource' => trans('cortex/auth::common.role'), 'identifier' => $role->title])],
        ]);
    }
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
294435
public function removeUserRole($user, $role)
    {
        $user   =   $this->findUserById($user);
        $role   =   $this->findRoleByKey($role);

        if ($user->not($role->key)) {
            return true;
        }

        return $user->leave($role);
    }
538465
public function removeRole($role)
    {
        if ($this->instance instanceof \Phavour\Session\Storage) {
            if (!$this->hasRole($role)) {
                return false;
            }
            if ($this->instance->isLocked()) {
                $this->instance->unlock();
            }
            $roles = $this->instance->get('roles');
            if (is_array($roles)) {
                $new = array();
                foreach ($roles as $old) {
                    if ($old != $role) {
                        $new[] = $old;
                    }
                }
                $this->instance->set('roles', $new);
            }

            $this->instance->lock();
            return true;
        }

        return false;
    }
665644
def remove_role(self, role):
        
        if role in self.__roles:
            self.__roles.remove(role)
1022262
public function removeRole(ChildRole $role)
    {
        if ($this->getRoles()->contains($role)) { $rolePermission = new ChildRolePermission();

            $rolePermission->setRole($role);
            if ($role->isPermissionsLoaded()) {
                //remove the back reference if available
                $role->getPermissions()->removeObject($this);
            }

            $rolePermission->setPermission($this);
            $this->removeRolePermission(clone $rolePermission);
            $rolePermission->clear();

            $this->collRoles->remove($this->collRoles->search($role));

            if (null === $this->rolesScheduledForDeletion) {
                $this->rolesScheduledForDeletion = clone $this->collRoles;
                $this->rolesScheduledForDeletion->clear();
            }

            $this->rolesScheduledForDeletion->push($role);
        }


        return $this;
    }