Creates a form to edit a PermissionsGroup entity.

@param PermissionsGroup $permissionsGroup The entity

@return \Symfony\Component\Form\Form The form
518809
private function createEditForm(PermissionsGroup $permissionsGroup)
    {
        $form = $this->createForm(new PermissionsGroupType(), $permissionsGroup, array(
            'action' => $this->generateUrl('admin_permissionsgroup_update', array('id' => $permissionsGroup->getId())),
            'method' => 'PUT',
        ));

        $form->add('submit', 'submit', array('label' => 'Update'));

        return $form;
    }
1178089
public function edit(AttributeGroup $group)
    {
        $repository = app('TypiCMS\Modules\Attributes\Shells\Repositories\AttributeInterface');
        $models = $repository->allNestedBy('attribute_group_id', $group->id, [], true);
        app('JavaScript')->put('models', $models);

        return view('attributes::admin.edit-group')
            ->with(['model' => $group]);
    }
540992
public function formForGroupAction(Group $group)
    {
        $url = $this->router->generate('claro_message_show', array('message' => 0))
            . '?grpsIds[]=' . $group->getId();

        return new RedirectResponse($url);
    }
961364
public function addAllowedUserGroup(UserGroup $allowedUserGroup)
    {
        if ($this->allowedUserGroups->contains($allowedUserGroup) === false) {
            $this->allowedUserGroups->add($allowedUserGroup);
        }

        return $this;
    }
791721
protected function authzGroupsAreEqual($permissionAuthzGroup, $authzGroup)
    {
        return $this->pathsAreEqual($permissionAuthzGroup, $authzGroup) && 
            $this->queryParamsAreEqual($permissionAuthzGroup, $authzGroup);
    }
981670
private function updateRights(Group $group, array $config)
    {
        $securityIdentity = new UserSecurityIdentity($group->getObjectIdentifier(), Group::class);

        foreach ($config as $object => $rights) {
            $methodName = sprintf('add%sRights', ucfirst($object));
            if (method_exists($this, $methodName)) {
                call_user_func_array([$this, $methodName], [$rights, $securityIdentity]);
            }
        }
    }
695513
public function setPermissions($permissions , $password)
    {
        if ( ! is_array($permissions) || ! is_string($password) || $password === '' ) {
            throw new InvalidException('Permissions and password must be respectively an array and a string');
        }
        try {
            $this->getSoapClient()->SetDocumentAccessPermissions(array(
                'permissions' => $permissions ,
                'password'    => $password ,
            ));

            return $this;
        } catch ( SoapException $ex ) {
            throw new PermissionsException('Error while setting the list of permissions and master password for the document' , $ex);
        }
    }
1234819
protected function createPermissions()
    {
        $userPermissions = $this->permissions;

        $rolePermissions = [];

        foreach ($this->roles as $role) {
            $rolePermissions[] = $role->permissions;
        }

        return new static::$permissionsClass($userPermissions, $rolePermissions);
    }
11695
private function GrantCreateLayout()
    {
        $groups = $this->GetGroups();
        foreach ($groups as $group)
        {
            if ($group->GetCreateLayouts())
            {
                return GrantResult::Allowed();
            }
        }
        return GrantResult::NoAccess();
    }
125669
public static function createAskForPermissionsConsent(array $permissions): self
    {
        if (empty($permissions) || !empty(array_diff($permissions, self::PERMISSIONS))) {
            throw new InvalidCardPermissionsException();
        }

        $card = new self(self::TYPE_ASK_FOR_PERMISSIONS_CONSENT);

        $card->permissions = $permissions;

        return $card;
    }
578031
public function create(array $attributes)
	{
		if ( ! isset($credentials['permissions']) )
		{
			$credentials['permissions'] = array();
		}

		$group = $this->createModel();
		$group->values($attributes, array('name', 'permissions'));
		$group->save();

		return $group;
	}
601202
public function syncPermissions($permissions = [], $team = null, $detaching = true)
    {
        return $this->syncModels('permissions', $permissions, $team, $detaching);
    }
402013
public function removeAllowedUserGroup(UserGroup $allowedUserGroup)
    {
        if ($this->allowedUserGroups->contains($allowedUserGroup) === true) {
            $this->allowedUserGroups->removeElement($allowedUserGroup);
        }

        return $this;
    }
452056
private function mapPermissions(array $userPermission, array $permissions, callable $reduce)
    {
        foreach ($permissions as $attribute => $value) {
            if (!isset($userPermission[$attribute])) {
                $userPermission[$attribute] = false;
            }

            $userPermission[$attribute] = $reduce($userPermission[$attribute], $value);
        }

        return $userPermission;
    }
992537
public function attachPermissions($permissions = [], $team = null)
    {
        foreach ($permissions as $permission) {
            $this->attachPermission($permission, $team);
        }

        return $this;
    }
352273
function it_can_grant_access_to_roles_by_appending_actions($resourceObject, $groupRules, $groupActionRule)
    {
        $role = $this->getRoleWithName('user');
        $groupRules->update(Argument::any())->shouldBeCalled();
        $groupActionRule->addAction('foo')->shouldBeCalled();
        $this->grantRoleAccess($role, $resourceObject, 'foo');
    }
16199
public static function addPermissions(array $permissions)
    {
        $rows = [];

        foreach ($permissions as $permission => $groups) {
            foreach ((array) $groups as $group) {
                $rows[] = [
                    'group_id' => $group,
                    'permission' => $permission,
                ];
            }
        }

        return [
            'up' => function (Builder $schema) use ($rows) {
                $db = $schema->getConnection();

                foreach ($rows as $row) {
                    if ($db->table('group_permission')->where($row)->exists()) {
                        continue;
                    }

                    if ($db->table('groups')->where('id', $row['group_id'])->doesntExist()) {
                        continue;
                    }

                    $db->table('group_permission')->insert($row);
                }
            },

            'down' => function (Builder $schema) use ($rows) {
                $db = $schema->getConnection();

                foreach ($rows as $row) {
                    $db->table('group_permission')->where($row)->delete();
                }
            }
        ];
    }