From: <gem...@li...> - 2011-12-21 12:24:31
|
Revision: 381 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=381&view=rev Author: mennodekker Date: 2011-12-21 12:24:20 +0000 (Wed, 21 Dec 2011) Log Message: ----------- QuickFix: Allow pr.staff.edit.all to change the userclass from the default for the organization to allow special accounts to use a different auth method Modified Paths: -------------- trunk/library/classes/Gems/Default/StaffAction.php Modified: trunk/library/classes/Gems/Default/StaffAction.php =================================================================== --- trunk/library/classes/Gems/Default/StaffAction.php 2011-12-21 09:43:26 UTC (rev 380) +++ trunk/library/classes/Gems/Default/StaffAction.php 2011-12-21 12:24:20 UTC (rev 381) @@ -123,7 +123,16 @@ $ucfirst = new Zend_Filter_Callback('ucfirst'); - $bridge->addHiddenMulti('gsf_id_user', 'gul_id_user', 'gup_id_user', 'gul_user_class', 'gul_login', 'gul_id_organization'); + $bridge->addHiddenMulti('gsf_id_user', 'gul_id_user', 'gup_id_user', 'gul_login', 'gul_id_organization'); + + //Escape for local users when using radius, should be changed to something more elegant later + //@@TODO: Think of a better way to allow multiple methods per organization + if ($this->escort->hasPrivilege('pr.staff.edit.all')) { + $model->set('gul_user_class', 'label', $this->_('User Definition')); + $bridge->add('gul_user_class'); + } else { + $bridge->addHidden('gul_user_class'); + } //@@TODO: How do we change this? Only per org, or allow per user? //What classes are available? Maybe use something like event loader and add a little desc. to each type? $bridge->addText('gsf_login', 'size', 15, 'minlength', 4, @@ -224,7 +233,7 @@ //otherwise use the defaultStaffDefinition $org = $this->loader->getOrganization($this->menu->getParameterSource()->getMenuParameter('gsf_id_organization', $this->loader->getCurrentUser()->getCurrentOrganizationId())); $orgDef = $org->get('gor_user_class', $this->defaultStaffDefinition); - $model->set('gul_user_class', 'default', $orgDef); + $model->set('gul_user_class', 'default', $orgDef, 'multiOptions', $this->loader->getUserLoader()->getAvailableStaffDefinitions()); $model->set('gsf_iso_lang', 'label', $this->_('Language'), 'multiOptions', $this->util->getLocalized()->getLanguages()); $model->set('gul_can_login', 'label', $this->_('Can login'), 'multiOptions', $this->util->getTranslated()->getYesNo()); $model->set('gsf_logout_on_survey', 'label', $this->_('Logout on survey'), 'multiOptions', $this->util->getTranslated()->getYesNo()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-01-18 15:47:26
|
Revision: 411 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=411&view=rev Author: mennodekker Date: 2012-01-18 15:47:17 +0000 (Wed, 18 Jan 2012) Log Message: ----------- Fixed #46: Deleted staff can be reactivated when duplicate login is found on creation Modified Paths: -------------- trunk/library/classes/Gems/Default/StaffAction.php Modified: trunk/library/classes/Gems/Default/StaffAction.php =================================================================== --- trunk/library/classes/Gems/Default/StaffAction.php 2012-01-18 12:28:40 UTC (rev 410) +++ trunk/library/classes/Gems/Default/StaffAction.php 2012-01-18 15:47:17 UTC (rev 411) @@ -194,6 +194,83 @@ } /** + * Modified createAction to allow reactivation of deleted users + * + * When the gsf_login had the 'recordFound' error, we check if the user is deactivated. + * If so present the user and ask to confirm reactivation, otherwise show the erroneous form. + * + * When activated, we reroute to the edit action after reactivation (gsf_active => 1 and gul_can_login => 1) + * + * Uses $this->getModel() + * $this->addFormElements() + */ + public function createAction() + { + $this->html->h3(sprintf($this->_('New %s...'), $this->getTopic())); + + $confirmed = $this->getRequest()->getParam('confirmed'); + $id = $this->getRequest()->getParam('id'); + if (!is_null($confirmed)) { + if ($confirmed == true && intval($id) > 0) { + $id = intval($id); + $model = $this->getModel(); + $model->setFilter(array('gsf_id_user' => $id)); + $result = $model->loadFirst(); + if ($result) { + if ($result['gsf_active'] == 0 || $result['gul_can_login'] == 0) { + $result['gsf_active'] = 1; + $result['gul_can_login'] = 1; + $model->save($result); + $this->_reroute(array('action' => 'edit', 'id' => $id), true); + } + } + } + //Not confirmed or id invalid redirect to index + $this->_reroute(array('action' => 'index'), true); + } + + if ($form = $this->processForm()) { + if ($element = $form->getElement('gsf_login')) { + $errors = $element->getErrors(); + if (array_search('recordFound', $errors) !== false) { + //We have a duplicate login! + $model = $this->getModel(); + $model->setFilter(array( + 'gsf_login' => $form->getValue('gsf_login'), + 'gsf_id_organization' => $form->getValue('gsf_id_organization') + )); + $result = $model->load(); + + if (count($result) == 1) { + $result = array_shift($result); //Get the first (only) row + if ($result['gsf_active'] == 0 || $result['gul_can_login'] == 0) { + //Ok we try to add an inactive user... + //now ask if this is the one we would like to reactivate? + $question = sprintf($this->_('User with id %s already exists but is deleted, do you want to reactivate the account?'), $result['gsf_login']); + + $repeater = $model->loadRepeatable(); + $table = $this->getShowTable(); + $table->caption($question); + $table->setRepeater($repeater); + + $footer = $table->tfrow($question, ' ', array('class' => 'centerAlign')); + $footer->actionLink(array('confirmed' => true, 'id' => $result['gsf_id_user']), $this->_('Yes')); + $footer->actionLink(array('confirmed' => 0), $this->_('No')); + + $this->html[] = $table; + $this->html->buttonDiv($this->createMenuLinks()); + return; + } else { + //User is active... this is a real duplicate so continue the flow + } + } + } + } + $this->html[] = $form; + } + } + + /** * Creates a model for getModel(). Called only for each new $action. * * The parameters allow you to easily adapt the model to the current action. The $detailed This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-01-25 14:33:53
|
Revision: 422 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=422&view=rev Author: mennodekker Date: 2012-01-25 14:33:44 +0000 (Wed, 25 Jan 2012) Log Message: ----------- Fix to prevent change of userclass while editing of users with a UserDefinition that is not yet or no longer supported like the OldStaffUSerDefinition Modified Paths: -------------- trunk/library/classes/Gems/Default/StaffAction.php Modified: trunk/library/classes/Gems/Default/StaffAction.php =================================================================== --- trunk/library/classes/Gems/Default/StaffAction.php 2012-01-24 15:02:13 UTC (rev 421) +++ trunk/library/classes/Gems/Default/StaffAction.php 2012-01-25 14:33:44 UTC (rev 422) @@ -129,6 +129,14 @@ //@@TODO: Think of a better way to allow multiple methods per organization if ($this->escort->hasPrivilege('pr.staff.edit.all')) { $model->set('gul_user_class', 'label', $this->_('User Definition')); + + //Make sure old or experimental userdefinitions don't have to be changed to something that is + //allowed at the moment. For example the oldStaffUser can stay when editing a user. + $options = $model->get('gul_user_class', 'multiOptions'); + if (!array_key_exists($data['gul_user_class'], $options)) { + $options[$data['gul_user_class']] = $this->_('Unsupported UserDefinition'); + $model->set('gul_user_class', 'multiOptions', $options); + } $bridge->add('gul_user_class'); } else { $bridge->addHidden('gul_user_class'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Gemstracker-svn] SF.net SVN: gemstracker:[1152]
trunk/library/classes/Gems/Default/ StaffAction.php
From: <gem...@li...> - 2013-02-21 16:56:32
|
Revision: 1152 http://sourceforge.net/p/gemstracker/code/1152 Author: matijsdejong Date: 2013-02-21 16:56:30 +0000 (Thu, 21 Feb 2013) Log Message: ----------- A better language default Modified Paths: -------------- trunk/library/classes/Gems/Default/StaffAction.php Modified: trunk/library/classes/Gems/Default/StaffAction.php =================================================================== --- trunk/library/classes/Gems/Default/StaffAction.php 2013-02-21 15:49:51 UTC (rev 1151) +++ trunk/library/classes/Gems/Default/StaffAction.php 2013-02-21 16:56:30 UTC (rev 1152) @@ -59,6 +59,13 @@ public $defaultStaffDefinition = Gems_User_UserLoader::USER_STAFF; public $filterStandard = array('gsf_active' => 1); + + /** + * + * @var Gems_Project_ProjectSettings + */ + public $project; + public $sortKey = array('name' => SORT_ASC); /** @@ -348,7 +355,11 @@ $org = $this->loader->getOrganization($this->menu->getParameterSource()->getMenuParameter('gsf_id_organization', $this->loader->getCurrentUser()->getCurrentOrganizationId())); $orgDef = $org->get('gor_user_class', $this->defaultStaffDefinition); $model->set('gul_user_class', 'default', $orgDef, 'multiOptions', $this->loader->getUserLoader()->getAvailableStaffDefinitions()); - $model->set('gsf_iso_lang', 'label', $this->_('Language'), 'multiOptions', $this->util->getLocalized()->getLanguages()); + $model->set('gsf_iso_lang', + 'label', $this->_('Language'), + 'multiOptions', $this->util->getLocalized()->getLanguages(), + 'default', $this->project->locale['default'] + ); $model->set('gul_can_login', 'label', $this->_('Can login'), 'multiOptions', $this->util->getTranslated()->getYesNo(), 'default', 1); $model->set('gsf_logout_on_survey', 'label', $this->_('Logout on survey'), 'multiOptions', $this->util->getTranslated()->getYesNo()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-04-24 14:01:31
|
Revision: 634 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=634&view=rev Author: mennodekker Date: 2012-04-24 14:01:21 +0000 (Tue, 24 Apr 2012) Log Message: ----------- Fixed wording so 'username' in login screen is the same as 'username' in the staff screen Modified Paths: -------------- trunk/library/classes/Gems/Default/StaffAction.php Modified: trunk/library/classes/Gems/Default/StaffAction.php =================================================================== --- trunk/library/classes/Gems/Default/StaffAction.php 2012-04-24 13:39:19 UTC (rev 633) +++ trunk/library/classes/Gems/Default/StaffAction.php 2012-04-24 14:01:21 UTC (rev 634) @@ -267,7 +267,7 @@ $model = $this->loader->getModels()->getStaffModel(); - $model->set('gsf_login', 'label', $this->_('Login')); + $model->set('gsf_login', 'label', $this->_('Username')); $model->set('name', 'label', $this->_('Name'), 'column_expression', "CONCAT(COALESCE(CONCAT(gsf_last_name, ', '), '-, '), COALESCE(CONCAT(gsf_first_name, ' '), ''), COALESCE(gsf_surname_prefix, ''))"); $model->set('gsf_email', 'label', $this->_('E-Mail'), 'itemDisplay', 'MUtil_Html_AElement::ifmail'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |