/** * Remove a user from a group. * * @param User $user * @param GroupGroupInterface $group * * @return bool */ public function removeFromGroup(User $user, Group\GroupInterface $group) { // Check the user has an id if (!$user->id) { throw new InvalidArgumentException('User id %s is not valid', $user->id); } $this->_query->run(' DELETE FROM user_group WHERE user_id = ?i, group_name = ?s ', array($user->id, $group->getName())); }
/** * Register a single group to this permission registry. * * @param Group\GroupInterface $group The group to register * * @return PermissionRegistry Returns $this for chainability */ protected function _registerGroup(Group\GroupInterface $group) { $permissions = new Group\Permissions($group); $permissions->run(); $this->_protectedRoutes = array_unique(array_merge($this->_protectedRoutes, $permissions->getRoutes())); $this->_protectedRouteCollections = array_unique(array_merge($this->_protectedRouteCollections, $permissions->getRouteCollections())); $this->_permissions[$group->getName()] = $permissions; return $this; }