From: <gem...@li...> - 2011-09-15 15:08:29
|
Revision: 25 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=25&view=rev Author: matijsdejong Date: 2011-09-15 15:08:23 +0000 (Thu, 15 Sep 2011) Log Message: ----------- - #4 seeing staff from other organizations is now a separate privilege - minor bug: autoupdate right was not set for project view in SingleTrack projects Modified Paths: -------------- trunk/library/classes/Gems/Default/StaffAction.php trunk/library/classes/Gems/Menu/MenuAbstract.php trunk/library/classes/Gems/Menu.php trunk/library/configs/db/tables/gems__roles.20.sql Modified: trunk/library/classes/Gems/Default/StaffAction.php =================================================================== --- trunk/library/classes/Gems/Default/StaffAction.php 2011-09-15 14:54:38 UTC (rev 24) +++ trunk/library/classes/Gems/Default/StaffAction.php 2011-09-15 15:08:23 UTC (rev 25) @@ -150,7 +150,7 @@ $groups = $this->db->fetchPairs($sql); if (($this->session->user_role == 'admin' && isset($groups) && $groups[$data['gsf_id_primary_group']] == 'super') - || (!$this->escort->hasPrivilege('pr.staff.edit.all') && + || (! $this->escort->hasPrivilege('pr.staff.edit.all') && $data['gsf_id_organization'] != $this->escort->getCurrentOrganization())) { throw new Zend_Exception($this->_('You are not allowed to edit this staff member.')); } @@ -179,10 +179,12 @@ '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'); - $model->set('gsf_id_organization', 'label', $this->_('Organization'), - 'multiOptions', $this->util->getDbLookup()->getOrganizations(), - 'default', $this->escort->getCurrentOrganization()); - + if ($this->escort->hasPrivilege('pr.staff.see.all')) { + $model->set('gsf_id_organization', 'label', $this->_('Organization'), + 'multiOptions', $this->util->getDbLookup()->getOrganizations(), + 'default', $this->escort->getCurrentOrganization()); + } + $model->set('gsf_id_primary_group', 'label', $this->_('Primary function'), 'multiOptions', MUtil_Lazy::call($this->util->getDbLookup()->getStaffGroups)); $model->set('gsf_gender', 'label', $this->_('Gender'), 'multiOptions', $this->util->getTranslated()->getGenders()); @@ -202,9 +204,14 @@ { $elements = parent::getAutoSearchElements($model, $data); - // Select organization - $options = array('' => $this->_('(all organizations)')) + $this->getModel()->get('gsf_id_organization', 'multiOptions'); - $select = new Zend_Form_Element_Select('gsf_id_organization', array('multiOptions' => $options)); + if ($this->escort->hasPrivilege('pr.staff.see.all')) { + // Select organization + $options = array('' => $this->_('(all organizations)')) + $this->getModel()->get('gsf_id_organization', 'multiOptions'); + $select = new Zend_Form_Element_Select('gsf_id_organization', array('multiOptions' => $options)); + } else { + $select = new Zend_Form_Element_Hidden('gsf_id_organization', + array('value' => $this->escort->getCurrentOrganization())); + } // Position as second element $search = array_shift($elements); Modified: trunk/library/classes/Gems/Menu/MenuAbstract.php =================================================================== --- trunk/library/classes/Gems/Menu/MenuAbstract.php 2011-09-15 14:54:38 UTC (rev 24) +++ trunk/library/classes/Gems/Menu/MenuAbstract.php 2011-09-15 15:08:23 UTC (rev 25) @@ -253,6 +253,8 @@ $trackSurveys->addAction($this->_('Preview'), 'pr.project.questions', 'questions') ->addNamedParameters(MUtil_Model::REQUEST_ID, 'gro_id_track', Gems_Model::SURVEY_ID, 'gsu_id_survey'); + $infoPage->addAutofilterAction(); + // MUtil_Echo::track($infoPage->_toNavigationArray(array($this->escort->request))); } else { if ($this->escort instanceof Gems_Project_Tracks_StandAloneSurveysInterface) { Modified: trunk/library/classes/Gems/Menu.php =================================================================== --- trunk/library/classes/Gems/Menu.php 2011-09-15 14:54:38 UTC (rev 24) +++ trunk/library/classes/Gems/Menu.php 2011-09-15 15:08:23 UTC (rev 25) @@ -606,6 +606,7 @@ $this->addHiddenPrivilige('pr.respondent.result'); $this->addHiddenPrivilige('pr.respondent.who'); $this->addHiddenPrivilige('pr.staff.edit.all'); + $this->addHiddenPrivilige('pr.staff.see.all'); $this->addHiddenPrivilige('pr.token.mail.freetext'); Modified: trunk/library/configs/db/tables/gems__roles.20.sql =================================================================== --- trunk/library/configs/db/tables/gems__roles.20.sql 2011-09-15 14:54:38 UTC (rev 24) +++ trunk/library/configs/db/tables/gems__roles.20.sql 2011-09-15 15:08:23 UTC (rev 25) @@ -32,5 +32,5 @@ ('staff','staff','pr.option.edit,pr.option.password,pr.plan,pr.plan.overview,pr.plan.token,pr.project,pr.project.questions,pr.respondent.create,pr.respondent.edit,pr.respondent.who,pr.setup,pr.staff,pr.survey,pr.survey.create,pr.token,pr.token.answers,pr.token.delete,pr.token.edit,pr.token.mail,pr.token.print,pr.track,pr.track.create,pr.track.delete,pr.track.edit,pr.respondent.reportdeath','guest', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), ('physician','physician','','staff', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), ('researcher','researcher','pr.invitation,pr.result,pr.islogin','', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), - ('admin','admin','pr.consent,pr.consent.create,pr.consent.edit,pr.group,pr.role,pr.mail,pr.mail.create,pr.mail.delete,pr.mail.edit,pr.organization,pr.organization-switch,pr.plan.overview.excel,pr.plan.respondent,pr.plan.respondent.excel,pr.plan.token.excel,pr.project-information,pr.reception,pr.reception.create,pr.reception.edit,pr.respondent.choose-org,pr.respondent.delete,pr.respondent.result,pr.source,pr.staff.create,pr.staff.delete,pr.staff.edit,pr.survey-maintenance,pr.track-maintenance,pr.token.mail.freetext','staff,researcher,security', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), + ('admin','admin','pr.consent,pr.consent.create,pr.consent.edit,pr.group,pr.role,pr.mail,pr.mail.create,pr.mail.delete,pr.mail.edit,pr.organization,pr.organization-switch,pr.plan.overview.excel,pr.plan.respondent,pr.plan.respondent.excel,pr.plan.token.excel,pr.project-information,pr.reception,pr.reception.create,pr.reception.edit,pr.respondent.choose-org,pr.respondent.delete,pr.respondent.result,pr.source,pr.staff.create,pr.staff.delete,pr.staff.edit,pr.staff.see.all,pr.survey-maintenance,pr.track-maintenance,pr.token.mail.freetext','staff,researcher,security', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), ('super','super','pr.consent.delete,pr.country,pr.country.create,pr.country.delete,pr.country.edit,pr.database,pr.database.create,pr.database.delete,pr.database.edit,pr.database.execute,pr.database.patches,pr.group.create,pr.group.edit,pr.role.create,pr.role.edit,pr.language,pr.organization.create,pr.organization.edit,pr.plan.choose-org,pr.plan.mail-as-application,pr.reception.delete,pr.source.create,pr.source.edit,pr.source.synchronize,pr.source.synchronize-all,pr.staff.edit.all,pr.survey-maintenance.edit,pr.track-maintenance.create,pr.track-maintenance.edit','admin', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |