示例#1
0
 public function configure()
 {
     parent::configure();
     unset($this['is_super_admin']);
     $this->setWidget('groups_list', new sfWidgetFormDoctrineChoice(array('model' => 'sfGuardGroup', 'expanded' => true, 'multiple' => true)));
     $this->widgetSchema->getFormFormatter()->setTranslationCatalogue('apostrophe');
 }
 public function configure()
 {
     parent::configure();
     $this->setWidget('sf_guard_user_group_list', new sfWidgetFormPropelChoice(array('model' => 'sfGuardGroup', 'peer_method' => 'retrieveGroups', 'multiple' => true, "renderer_class" => "csWidgetFormSelectDoubleList")));
     unset($this['last_login'], $this['is_super_admin'], $this['created_at'], $this['salt'], $this['algorithm'], $this['is_active'], $this['sf_guard_user_permission_list']);
     $this->validatorSchema['username'] = new sfValidatorRegex(array('pattern' => '/^[a-z0-9_-]{3,16}$/'), array('invalid' => 'El nombre de usuario debe ser de entre 3 y 16 caracteres y contener letras, número o - y _'));
 }
示例#3
0
 /**
  * DOCUMENT ME
  */
 public function configure()
 {
     parent::configure();
     // Easy to override
     $this->useFields($this->getUseFields());
     unset($this['is_super_admin']);
     $this->widgetSchema->getFormFormatter()->setTranslationCatalogue('apostrophe');
     // It's convenient to kill these when using Shibboleth
     if (!sfConfig::get('app_a_user_admin_password', true)) {
         unset($this['password']);
         unset($this['password_again']);
     }
     if (!sfConfig::get('app_a_user_admin_is_active', true)) {
         unset($this['is_active']);
     }
     // Handing out permissions directly is usually a mistake, use groups and
     // restrict full permissions admin to the superadmin
     if (!sfConfig::get('app_a_user_admin_permissions', false)) {
         unset($this['permissions_list']);
     }
     $this->getWidget('groups_list')->setOption('query', Doctrine::getTable('sfGuardGroup')->createQuery()->orderBy('sfGuardGroup.name asc'));
     $this->getWidget('categories_list')->setOption('query', Doctrine::getTable('aCategory')->createQuery()->orderBy('aCategory.name asc'));
     $this->widgetSchema->setHelp('groups_list', 'If you want to grant a user the ability to edit a portion of the site as an individual, first add them to the editor group. Then browse to that area of the site and click Page Settings to add them to the list of users who can edit in that particular area. You can also add them to a group that has the Editor permission and grant that group editing privileges anywhere in the site. If you want a user to have full control over the entire site, add them to the admin group.');
     $this->widgetSchema->setHelp('categories_list', 'Adding the "news" category grants that user or group the ability to categorize content as "news," with the consequence that blog pages and blog slots that display "news" will display that content. In order to post content in the first place, the user must also be a potential editor. In addition to admins, users who have been specifically granted membership in the "editor" group or any other group that has been given the "editor" permission are potential editors.');
     foreach ($this->getUseFields() as $field) {
         $this->getWidget($field)->setAttribute('autocomplete', 'off');
     }
 }
 /**
  * @see sfForm
  */
 public function configure()
 {
     parent::configure();
     unset($this['groups_list'], $this['permissions_list']);
     $this->widgetSchema['password'] = new sfWidgetFormInputHidden(array('label' => ' '));
     $this->widgetSchema['password_again'] = new sfWidgetFormInputHidden(array('label' => ' '));
 }
 public function configure()
 {
     parent::configure();
     $this->widgetSchema['sf_guard_user_group_list'] = new sfWidgetFormInputHidden();
     $this->validatorSchema['sf_guard_user_group_list'] = new sfValidatorPass();
     $this->widgetSchema['sf_guard_user_permission_list'] = new sfWidgetFormInputHidden();
     $this->validatorSchema['sf_guard_user_permission_list'] = new sfValidatorPass();
 }
 public function updateObject($values = null)
 {
     $user = parent::updateObject($values);
     if (is_numeric($this->getValue('person_id'))) {
         $user->setPersonId($this->getValue('person_id'));
     }
     return $user;
 }
 /**
  * @see sfGuardUserForm
  */
 public function configure()
 {
     unset($this['procedures_list']);
     $this->widgetSchema['groups_list'] = new sfWidgetFormDoctrineChoice(array('model' => 'sfGuardGroup', 'multiple' => 'true', 'expanded' => true));
     $this->widgetSchema['permissions_list'] = new sfWidgetFormDoctrineChoice(array('model' => 'sfGuardPermission', 'multiple' => 'true', 'expanded' => true));
     $this->embedRelation('profile');
     parent::configure();
 }
示例#8
0
 public function bind(array $taintedValues = null, array $taintedFiles = null, $img = false)
 {
     // remove the embedded new form if the name field was not provided
     $taintedValues['vanity'] = SfVoUtil::fixVanityChars($taintedValues['vanity']);
     for ($idx = 1; $idx <= 5; $idx++) {
         if (is_null($taintedValues["enlace_n{$idx}"]['url'])) {
             unset($this->embeddedForms["enlace_n{$idx}"], $taintedValues["enlace_n{$idx}"]);
             $this->validatorSchema["enlace_n{$idx}"]['url'] = new sfValidatorUrl(array('required' => false));
         } else {
             $this->validatorSchema["enlace_n{$idx}"]['url'] = new sfVoValidatorUrl(array('required' => false), sfVoForm::getUrlMessages());
             $this->embeddedForms["enlace_n{$idx}"]->getObject()->setSfGuardUser($this->getObject());
         }
     }
     // call parent bind method
     parent::bind($taintedValues, $taintedFiles);
 }
 public function setup()
 {
     parent::setup();
     unset($this['is_active'], $this['is_super_admin'], $this['updated_at'], $this['groups_list'], $this['permissions_list']);
     $this->validatorSchema['password']->setOption('required', true);
 }
示例#10
0
 public function configure()
 {
     parent::configure();
     unset($this['last_login'], $this['created_at'], $this['salt'], $this['algorithm'], $this['is_active'], $this['is_super_admin'], $this['sf_guard_user_group_list'], $this['sf_guard_user_permission_list']);
 }
 public function executeUpdate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod('post') || $request->isMethod('put'));
     $a = $request->getParameter('sf_guard_user');
     $this->forward404Unless($sf_guard_user = Doctrine::getTable('sfGuardUser')->find(array($a['id'])), sprintf('Object sf_guard_user does not exist (%s).', $request->getParameter('id')));
     $form = new sfGuardUserAdminForm($sf_guard_user);
     $form->bind($request->getParameter($form->getName()));
     if ($form->isValid()) {
         $form->getObject()->getProfile()->is_invite = false;
         $sf_guard_user = $form->save();
         $this->forward('user', 'my');
     }
     $this->form = $form;
     $this->setTemplate('edit');
 }
示例#12
0
 public function setup()
 {
     parent::setup();
     $this->useFields(array('username', 'password', 'password_again'));
 }