Displays a form to edit an existing PermissionsGroup entity.
435690
public function editAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        $permissionsGroup = $em->getRepository('ChillMainBundle:PermissionsGroup')->find($id);

        if (!$permissionsGroup) {
            throw $this->createNotFoundException('Unable to find PermissionsGroup entity.');
        }

        $editForm = $this->createEditForm($permissionsGroup);
        
        $deleteRoleScopesForm = array();
        foreach ($permissionsGroup->getRoleScopes() as $roleScope) {
            $deleteRoleScopesForm[$roleScope->getId()] = $this->createDeleteRoleScopeForm(
                    $permissionsGroup, $roleScope);
        }
        
        $addRoleScopesForm = $this->createAddRoleScopeForm($permissionsGroup);

        return $this->render('ChillMainBundle:PermissionsGroup:edit.html.twig', array(
            'entity'      => $permissionsGroup,
            'edit_form'   => $editForm->createView(),
            'expanded_roles' => $this->getExpandedRoles($permissionsGroup->getRoleScopes()->toArray()),
            'delete_role_scopes_form' => array_map( function($form) { 
                
                return $form->createView(); 
            }, $deleteRoleScopesForm),
            'add_role_scopes_form' => $addRoleScopesForm->createView()
        ));
    }
1096052
private GroupDto insertOwnersGroup(DbSession dbSession, OrganizationDto organization) {
    GroupDto group = dbClient.groupDao().insert(dbSession, new GroupDto()
      .setOrganizationUuid(organization.getUuid())
      .setName(OWNERS_GROUP_NAME)
      .setDescription(format(OWNERS_GROUP_DESCRIPTION_PATTERN, organization.getName())));
    permissionService.getAllOrganizationPermissions().forEach(p -> addPermissionToGroup(dbSession, group, p));
    return group;
  }
519410
public function updateEditForm($form){
		if($this->modelIsMultiSitesAware()) {
			$managedSites = Multisites::inst()->sitesManagedByMember();
			$source = Site::get()->filter('ID', Multisites::inst()->sitesManagedByMember())->map('ID', 'Title')->toArray();
			$plural = singleton($this->owner->modelClass)->plural_name();
			if(!count($source)){
				$form->setFields(FieldList::create(
					LiteralField::create('NotAManager', "You do not have permission to manage $plural on any Sites")
				));
			}
		}
	}
439283
void submitForm(CmsForm formParam, final Map<String, String> fieldValues, Set<String> editedFields) {

        String modelGroupId = null;

        if (CmsInheritanceContainerEditor.getInstance() != null) {
            CmsInheritanceContainerEditor.getInstance().onSettingsEdited();
        }
        if (m_contextsWidget != null) {
            String newTemplateContexts = m_contextsWidget.getFormValueAsString();
            if ((newTemplateContexts == null) || "".equals(newTemplateContexts)) {
                newTemplateContexts = CmsTemplateContextInfo.EMPTY_VALUE;
                // translate an empty selection to "none"
            }
            fieldValues.put(CmsTemplateContextInfo.SETTING, newTemplateContexts);
        }
        final boolean hasFormatterChanges;
        if (m_formatterSelect != null) {
            fieldValues.put(
                CmsFormatterConfig.getSettingsKeyForContainer(m_containerId),
                m_formatterSelect.getFormValueAsString());
            hasFormatterChanges = true;
        } else {
            hasFormatterChanges = false;
        }
        if (m_createNewCheckBox != null) {
            m_elementWidget.setCreateNew(m_createNewCheckBox.isChecked());
            fieldValues.put(CmsContainerElement.CREATE_AS_NEW, Boolean.toString(m_createNewCheckBox.isChecked()));
        }
        if (m_modelGroupSelect != null) {
            GroupOption group = GroupOption.valueOf(m_modelGroupSelect.getFormValueAsString());
            switch (group) {
                case disabled:
                    fieldValues.put(CmsContainerElement.MODEL_GROUP_STATE, ModelGroupState.noGroup.name());
                    fieldValues.put(CmsContainerElement.USE_AS_COPY_MODEL, Boolean.toString(false));
                    break;
                case copy:
                    fieldValues.put(CmsContainerElement.MODEL_GROUP_STATE, ModelGroupState.isModelGroup.name());
                    fieldValues.put(CmsContainerElement.USE_AS_COPY_MODEL, Boolean.toString(true));
                    break;
                case reuse:
                    fieldValues.put(CmsContainerElement.MODEL_GROUP_STATE, ModelGroupState.isModelGroup.name());
                    fieldValues.put(CmsContainerElement.USE_AS_COPY_MODEL, Boolean.toString(false));
                    break;
                default:
                    break;
            }
            if (group != GroupOption.disabled) {
                modelGroupId = CmsContainerpageController.getServerId(m_elementBean.getClientId());
            }
        }

        if ((m_modelGroupBreakUp != null) && m_modelGroupBreakUp.isChecked()) {
            fieldValues.put(CmsContainerElement.MODEL_GROUP_STATE, ModelGroupState.noGroup.name());
        }

        final Map<String, String> filteredFieldValues = new HashMap<String, String>();
        for (Map.Entry<String, String> entry : fieldValues.entrySet()) {
            String key = entry.getKey();
            String value = entry.getValue();
            if ((value != null) && (value.length() > 0)) {
                filteredFieldValues.put(key, value);
            }
        }
        final String changeModelGroupId = modelGroupId;
        m_controller.reloadElementWithSettings(
            m_elementWidget,
            m_elementBean.getClientId(),
            filteredFieldValues,
            new I_CmsSimpleCallback<CmsContainerPageElementPanel>() {

                public void execute(CmsContainerPageElementPanel result) {

                    if (isTemplateContextChanged()) {
                        // if the context multiselect box isn't displayed, of course it can't change values,
                        // and this code won't be executed.
                        CmsContainerpageController.get().handleChangeTemplateContext(
                            result,
                            filteredFieldValues.get(CmsTemplateContextInfo.SETTING));
                    }
                    if (hasFormatterChanges) {
                        updateCss();
                    }
                    if (result.getElement().getInnerHTML().contains(CmsGwtConstants.FORMATTER_RELOAD_MARKER)
                        && !CmsContainerpageController.get().isGroupcontainerEditing()) {
                        CmsContainerpageController.get().reloadPage();
                    }
                    if (m_modelGroupSelect != null) {
                        m_controller.setModelGroupElementId(changeModelGroupId);
                    }
                }

            });
    }
811631
public function Add() {
		if(!$this->_Permission())
			return;

      $this->Title(T('Add Role'));

      // Use the edit form with no roleid specified.
      $this->View = 'Edit';
      $this->Edit();
   }
680272
def createEditor(self, delegate, parent, _option):
        
        return GroupCtiEditor(self, delegate, parent=parent)
1362210
public function editGroup()
	{
        $this->defaultData();

		$clazz = $this->getCurrentClass();
		$group = $this->getCurrentInstance();

		$formContainer = new SignedFormInstance($clazz, $group);
		$myForm = $formContainer->getForm();
		if($myForm->isSubmited()){
			if($myForm->isValid()){
			    $this->validateInstanceRoot($group->getUri());

				$binder = new tao_models_classes_dataBinding_GenerisFormDataBinder($group);
				$group = $binder->bind($myForm->getValues());

		        $this->setData("selectNode", tao_helpers_Uri::encode($group->getUri()));
				$this->setData('message', __('Group saved'));
				$this->setData('reload', true);
			}
		}

		$memberProperty = $this->getProperty(GroupsService::PROPERTY_MEMBERS_URI);
		$memberForm = tao_helpers_form_GenerisTreeForm::buildReverseTree($group, $memberProperty);
		$memberForm->setData('title',	__('Select group test takers'));
		$this->setData('memberForm', $memberForm->render());

		if ($this->getServiceLocator()->get(common_ext_ExtensionsManager::SERVICE_ID)->isEnabled('taoDeliveryRdf')) {
		    $this->setData('deliveryForm', DeliveryWidget::renderDeliveryTree($group));
		}
        $updatedAt = $this->getServiceLocator()->get(ResourceWatcher::SERVICE_ID)->getUpdatedAt($group);
		$this->setData('updatedAt', $updatedAt);
		$this->setData('formTitle', __('Edit group'));
		$this->setData('myForm', $myForm->render());
		$this->setView('form_group.tpl');
	}
1361254
public void updateGroupDetails(GroupForm groupForm, IPerson updater) {

        if (!canEditGroup(updater, groupForm.getKey())) {
            throw new RuntimeAuthorizationException(
                    updater, IPermission.EDIT_GROUP_ACTIVITY, groupForm.getKey());
        }

        if (log.isDebugEnabled()) {
            log.debug("Updating group for group form [" + groupForm.toString() + "]");
        }

        // find the current version of this group entity
        IEntityGroup group = GroupService.findGroup(groupForm.getKey());
        group.setName(groupForm.getName());
        group.setDescription(groupForm.getDescription());

        // save the group, updating both its basic information and group
        // membership
        group.update();
    }
578836
public function editAction()
    {
        if(method_exists($this, 'getEditForm'))
        {
            $form = $this->getEditForm();
        }
        else
        {
            $form = $this->getForm();
        }

        $id = $this->getEvent()
                ->getRouteMatch()
                ->getParam('id', 0);

        $form->add([
            'type'       => 'Zend\Form\Element\Hidden',
            'name'       => 'id',
            'attributes' => [
                'id'    => 'id',
                'value' => $id,
            ],
            'filters'    => [
                [
                    'name' => 'Int',
                ],
            ],
            'validators' => [
                [
                    'name' => 'Digits',
                ],
            ],
        ]);

        $em            = $this->getEntityManager();
        $objRepository = $em->getRepository($this->getEntityClass());
        $entity        = $objRepository->find($id);
        $form->bind($entity);

        $redirectUrl = $this->url()->fromRoute($this->getActionRoute(), [], true);
        $prg         = $this->fileprg($form, $redirectUrl, true);

        if($prg instanceof Response)
        {
            return $prg;
        }
        elseif($prg === false)
        {
            $this->getEventManager()->trigger('getForm', $this, [
                'form'        => $form,
                'entityClass' => $this->getEntityClass(),
                'id'          => $id,
                'entity'      => $entity,
            ]);

            return [
                'entityForm' => $form,
                'entity'     => $entity,
            ];
        }

        $this->getEventManager()->trigger('getForm', $this, [
            'form'        => $form,
            'entityClass' => $this->getEntityClass(),
            'id'          => $id,
            'entity'      => $entity,
        ]);

        $savedEntity = $this->getEntityService()->save($form, $entity);

        if(!$savedEntity)
        {
            return [
                'entityForm' => $form,
                'entity'     => $entity,
            ];
        }

        $this->flashMessenger()->addSuccessMessage($this->getServiceLocator()
                        ->get('translator')
                        ->translate($this->successEditMessage));

        return $this->redirect()->toRoute($this->getActionRoute('list'), [], true);
    }
1074035
public void validateEditDetails(GroupForm group, MessageContext context) {

        // ensure the group name is set
        if (StringUtils.isBlank(group.getName())) {
            context.addMessage(
                    new MessageBuilder().error().source("name").code("please.enter.name").build());
        }
    }
692922
public function permissionForm(Container $container): void
	{
		/* @var $container IContainer */
		$container->addSelectUntranslated('role', 'cms.permissions.role')
			->setItems($this->orm->aclRoles->fetchPairs($this->viewSuperadmin));
		$container->addMultiSelectUntranslated('resource', 'cms.permissions.resource')
			->setItems($this->orm->aclResources->fetchPairsByResourceName());
		$container->addSelect('privilege', 'cms.permissions.privilege', $this->privileges);
		$container->addSelect('allowed', 'default.state', $this->access);
	}
571406
public function edit()
    {
        $config = $this->app->make(Repository::class);
        $this->set('form', $this->app->make('helper/form'));
        $this->set('data', $config->get('auth.external_concrete5', []));
        $this->set('redirectUri', $this->urlResolver->resolve(['/ccm/system/authentication/oauth2/external_concrete5/callback']));

        $list = $this->app->make(GroupList::class);
        $list->includeAllGroups();
        $this->set('groups', $list->getResults());
    }
801576
public function edit_instance_form($instance, MoodleQuickForm $mform, $context) {
        global $CFG;

        // Merge these two settings to one value for the single selection element.
        if ($instance->notifyall and $instance->expirynotify) {
            $instance->expirynotify = 2;
        }
        unset($instance->notifyall);

        $nameattribs = array('size' => '20', 'maxlength' => '255');
        $mform->addElement('text', 'name', get_string('custominstancename', 'enrol'), $nameattribs);
        $mform->setType('name', PARAM_TEXT);
        $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'server');

        $options = $this->get_status_options();
        $mform->addElement('select', 'status', get_string('status', 'enrol_self'), $options);
        $mform->addHelpButton('status', 'status', 'enrol_self');

        $options = $this->get_newenrols_options();
        $mform->addElement('select', 'customint6', get_string('newenrols', 'enrol_self'), $options);
        $mform->addHelpButton('customint6', 'newenrols', 'enrol_self');
        $mform->disabledIf('customint6', 'status', 'eq', ENROL_INSTANCE_DISABLED);

        $passattribs = array('size' => '20', 'maxlength' => '50');
        $mform->addElement('passwordunmask', 'password', get_string('password', 'enrol_self'), $passattribs);
        $mform->addHelpButton('password', 'password', 'enrol_self');
        if (empty($instance->id) and $this->get_config('requirepassword')) {
            $mform->addRule('password', get_string('required'), 'required', null, 'client');
        }
        $mform->addRule('password', get_string('maximumchars', '', 50), 'maxlength', 50, 'server');

        $options = $this->get_groupkey_options();
        $mform->addElement('select', 'customint1', get_string('groupkey', 'enrol_self'), $options);
        $mform->addHelpButton('customint1', 'groupkey', 'enrol_self');

        $roles = $this->extend_assignable_roles($context, $instance->roleid);
        $mform->addElement('select', 'roleid', get_string('role', 'enrol_self'), $roles);

        $options = array('optional' => true, 'defaultunit' => 86400);
        $mform->addElement('duration', 'enrolperiod', get_string('enrolperiod', 'enrol_self'), $options);
        $mform->addHelpButton('enrolperiod', 'enrolperiod', 'enrol_self');

        $options = $this->get_expirynotify_options();
        $mform->addElement('select', 'expirynotify', get_string('expirynotify', 'core_enrol'), $options);
        $mform->addHelpButton('expirynotify', 'expirynotify', 'core_enrol');

        $options = array('optional' => false, 'defaultunit' => 86400);
        $mform->addElement('duration', 'expirythreshold', get_string('expirythreshold', 'core_enrol'), $options);
        $mform->addHelpButton('expirythreshold', 'expirythreshold', 'core_enrol');
        $mform->disabledIf('expirythreshold', 'expirynotify', 'eq', 0);

        $options = array('optional' => true);
        $mform->addElement('date_time_selector', 'enrolstartdate', get_string('enrolstartdate', 'enrol_self'), $options);
        $mform->setDefault('enrolstartdate', 0);
        $mform->addHelpButton('enrolstartdate', 'enrolstartdate', 'enrol_self');

        $options = array('optional' => true);
        $mform->addElement('date_time_selector', 'enrolenddate', get_string('enrolenddate', 'enrol_self'), $options);
        $mform->setDefault('enrolenddate', 0);
        $mform->addHelpButton('enrolenddate', 'enrolenddate', 'enrol_self');

        $options = $this->get_longtimenosee_options();
        $mform->addElement('select', 'customint2', get_string('longtimenosee', 'enrol_self'), $options);
        $mform->addHelpButton('customint2', 'longtimenosee', 'enrol_self');

        $mform->addElement('text', 'customint3', get_string('maxenrolled', 'enrol_self'));
        $mform->addHelpButton('customint3', 'maxenrolled', 'enrol_self');
        $mform->setType('customint3', PARAM_INT);

        require_once($CFG->dirroot.'/cohort/lib.php');

        $cohorts = array(0 => get_string('no'));
        $allcohorts = cohort_get_available_cohorts($context, 0, 0, 0);
        if ($instance->customint5 && !isset($allcohorts[$instance->customint5])) {
            $c = $DB->get_record('cohort',
                                 array('id' => $instance->customint5),
                                 'id, name, idnumber, contextid, visible',
                                 IGNORE_MISSING);
            if ($c) {
                // Current cohort was not found because current user can not see it. Still keep it.
                $allcohorts[$instance->customint5] = $c;
            }
        }
        foreach ($allcohorts as $c) {
            $cohorts[$c->id] = format_string($c->name, true, array('context' => context::instance_by_id($c->contextid)));
            if ($c->idnumber) {
                $cohorts[$c->id] .= ' ['.s($c->idnumber).']';
            }
        }
        if ($instance->customint5 && !isset($allcohorts[$instance->customint5])) {
            // Somebody deleted a cohort, better keep the wrong value so that random ppl can not enrol.
            $cohorts[$instance->customint5] = get_string('unknowncohort', 'cohort', $instance->customint5);
        }
        if (count($cohorts) > 1) {
            $mform->addElement('select', 'customint5', get_string('cohortonly', 'enrol_self'), $cohorts);
            $mform->addHelpButton('customint5', 'cohortonly', 'enrol_self');
        } else {
            $mform->addElement('hidden', 'customint5');
            $mform->setType('customint5', PARAM_INT);
            $mform->setConstant('customint5', 0);
        }

        $mform->addElement('select', 'customint4', get_string('sendcoursewelcomemessage', 'enrol_self'),
                enrol_send_welcome_email_options());
        $mform->addHelpButton('customint4', 'sendcoursewelcomemessage', 'enrol_self');

        $options = array('cols' => '60', 'rows' => '8');
        $mform->addElement('textarea', 'customtext1', get_string('customwelcomemessage', 'enrol_self'), $options);
        $mform->addHelpButton('customtext1', 'customwelcomemessage', 'enrol_self');

        if (enrol_accessing_via_instance($instance)) {
            $warntext = get_string('instanceeditselfwarningtext', 'core_enrol');
            $mform->addElement('static', 'selfwarn', get_string('instanceeditselfwarning', 'core_enrol'), $warntext);
        }
    }
391427
public function edit_instance_form($instance, MoodleQuickForm $mform, $coursecontext) {
        global $DB;

        $groups = $this->get_group_options($coursecontext);
        $existing = $DB->get_records('enrol', array('enrol' => 'meta', 'courseid' => $coursecontext->instanceid), '', 'customint1, id');

        $excludelist = array($coursecontext->instanceid);
        foreach ($existing as $existinginstance) {
            $excludelist[] = $existinginstance->customint1;
        }

        $options = array(
            'requiredcapabilities' => array('enrol/meta:selectaslinked'),
            'multiple' => empty($instance->id),  // We only accept multiple values on creation.
            'exclude' => $excludelist
        );
        $mform->addElement('course', 'customint1', get_string('linkedcourse', 'enrol_meta'), $options);
        $mform->addRule('customint1', get_string('required'), 'required', null, 'client');
        if (!empty($instance->id)) {
            $mform->freeze('customint1');
        }

        $mform->addElement('select', 'customint2', get_string('addgroup', 'enrol_meta'), $groups);
    }
585324
def editpermissions_user_view(self, request, user_id, forum_id=None):
        
        user_model = get_user_model()
        user = get_object_or_404(user_model, pk=user_id)
        forum = get_object_or_404(Forum, pk=forum_id) if forum_id else None

        # Set up the context
        context = self.get_forum_perms_base_context(request, forum)
        context['forum'] = forum
        context['title'] = '{} - {}'.format(_('Forum permissions'), user)
        context['form'] = self._get_permissions_form(
            request, UserForumPermission, {'forum': forum, 'user': user},
        )

        return render(request, self.editpermissions_user_view_template_name, context)
248526
public function editAction(Request $request, $id)
    {
        $this->checkIfUserHasPermission(Permission::EDIT);

        list($parentEntity) = $this->getParentEntityDefinition($request);

        $entity = $this->getEntity($id);

        $entityBefore = clone $entity;

        $this->getEventDispatcher()->dispatch(
            Events::PRE_CRUD_CONTROLLER_ACTION,
            new CrudControllerActionEvent($this->meta, __FUNCTION__)
        );

        $form = $this->getAdminFormFactory()->createEntityForm(
            $this->meta,
            $entity,
            'edit',
            $this->getAdminRouter()->generate($entity, $this->entityClass, AdminRouter::TYPE_EDIT),
            $this->getEntityFormSubmitButtons()
        )->handleRequest($request);

        if ($this->getFormHandler()->handleEntityForm($form, 'action.edit.success')) {
            $this->getEventDispatcher()->dispatch(CrudEvents::UPDATED, new UpdatedEvent($this->getUser(), $entityBefore, $entity));

            return $this->successRedirect($form, $entity);
        }

        return $this->renderResponse('edit', [
            'entity'        => $entity,
            'form'          => $form->createView(),
            'meta'          => $this->meta,
            'parent_entity' => $parentEntity,
        ]);
    }
850134
def reset_access_controls!
      update!(edit_users: permission_template_edit_users,
              edit_groups: permission_template_edit_groups,
              read_users: permission_template_read_users,
              read_groups: (permission_template_read_groups + visibility_group).uniq)
    end