Loading front/src/EntityWithRole.vue +15 −4 Original line number Diff line number Diff line Loading @@ -125,8 +125,9 @@ </span> <div class="form-group" v-else> <label class=" control-label" for="enroled">{{ title }}</label> <personselector @change="handlerEnrolledSelected($event)" v-if="title == 'Personne'" v-model="selectedPerson"/> <organizationselector @change="handlerEnrolledSelected($event)" v-else/> <pre>{{ selected }} / {{ selectedPerson }}</pre> <personselector @change="handlerEnrolledSelectedPerson($event)" v-if="title == 'Personne'" v-model="selected"/> <organizationselector @change="handlerEnrolledSelected($event)" v-else v-model="selected" /> </div> <div class="form-group"> Loading Loading @@ -196,6 +197,8 @@ import OrganizationAutoCompleter from "./components/OrganizationAutoCompleter"; import PersonAutoCompleter from "./components/PersonAutoCompleter"; import Datepicker from "./components/Datepicker"; console.log("FOO"); export default { components: { organizationselector: OrganizationAutoCompleter, Loading @@ -215,6 +218,7 @@ export default { data() { return { selectedPerson: null, selected: null, entities: [], entityEdited: null, entityDelete: null, Loading Loading @@ -245,7 +249,12 @@ export default { }, handlerEnrolledSelected(data) { console.log(data); this.entityNew.enroled = data.id; this.entityNew.enroledLabel = data.label; }, handlerEnrolledSelectedPerson(data) { this.selected = data.id; this.entityNew.enroled = data.id; this.entityNew.enroledLabel = data.label; }, Loading Loading @@ -298,7 +307,8 @@ export default { performNew() { let data = new FormData(); this.loading = "Création..."; var enroled = this.entityNew.enroled; console.log("ENTITYNEW:", JSON.stringify(this.entityNew)); var enroled = this.selected; data.append('dateStart', this.entityNew.start); data.append('dateEnd', this.entityNew.end); data.append('role', this.entityNew.role); Loading Loading @@ -338,6 +348,7 @@ export default { }, mounted() { console.log("MOUNTED"); this.fetch(); } } Loading module/Oscar/src/Oscar/Controller/EnrollController.php +11 −3 Original line number Diff line number Diff line Loading @@ -116,10 +116,18 @@ class EnrollController extends AbstractOscarController implements UsePersonServi public function organizationProjectDeleteAction() { try { $idenroll = $this->params()->fromRoute('idenroll'); if( !$idenroll ){ throw new OscarException("Identifiant non-trouvé " . $idenroll); } /** @var ProjectPartner $enroll */ $enroll = $this->getEntityManager()->getRepository(ProjectPartner::class)->find( $this->params()->fromRoute('idenroll') ); $enroll = $this->getEntityManager()->getRepository(ProjectPartner::class)->find($idenroll); if( !$enroll ){ throw new OscarException("L'association Organization/Projet est manquante"); } $this->getOscarUserContextService()->check(Privileges::PROJECT_ORGANIZATION_MANAGE, $enroll->getProject()); $this->getProjectService()->removeProjectOrganization($enroll); Loading module/Oscar/src/Oscar/Controller/ProjectController.php +5 −0 Original line number Diff line number Diff line Loading @@ -238,11 +238,16 @@ class ProjectController extends AbstractOscarController return $this->htmlProjectDetail($entity); } $rolesOrganizations = $this->getOscarUserContextService()->getRolesOrganizationInActivity(); $rolesPersons = $this->getOscarUserContextService()->getAllRoleIdPersonInActivity(); return array( // 'access' => $this->getAccessResolverService()->getProjectAccess($entity), 'project' => $entity, 'documents' => $documents, 'rolesOrganizations' => $rolesOrganizations, 'rolesPersons' => $rolesPersons, 'logs' => $this->getActivityLogService()->projectActivities($entity->getId())->getQuery()->getResult() ); } catch (UnAuthorizedException $e) { Loading module/Oscar/src/Oscar/Controller/ProjectGrantController.php +4 −0 Original line number Diff line number Diff line Loading @@ -1897,6 +1897,10 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif /** @var Activity $entity */ $entity = $this->getEntityManager()->getRepository(Activity::class)->find($id); if(!$entity){ throw new OscarException("Cette activité n'existe plus/pas"); } // Check access $this->getOscarUserContextService()->check(Privileges::ACTIVITY_SHOW, $entity); Loading module/Oscar/src/Oscar/Formatter/EnrollToArrayFormatter.php +39 −40 Original line number Diff line number Diff line Loading @@ -78,47 +78,46 @@ class EnrollToArrayFormatter private $_conf; private function getConf($affectation){ if( $this->_conf === null ){ $this->_conf = new \stdClass(); $_conf = new \stdClass(); switch (get_class($affectation) ){ case ProjectPartner::class: $this->_conf->context = self::CONTEXT_PROJECT; $this->_conf->manage = Privileges::PROJECT_ORGANIZATION_MANAGE; $this->_conf->show = Privileges::PROJECT_ORGANIZATION_SHOW; $this->_conf->edit = 'organizationproject/edit'; $this->_conf->delete = 'organizationproject/delete'; $_conf->context = self::CONTEXT_PROJECT; $_conf->manage = Privileges::PROJECT_ORGANIZATION_MANAGE; $_conf->show = Privileges::PROJECT_ORGANIZATION_SHOW; $_conf->edit = 'organizationproject/edit'; $_conf->delete = 'organizationproject/delete'; break; case ProjectMember::class : $this->_conf->context = self::CONTEXT_PROJECT; $this->_conf->manage = Privileges::PROJECT_PERSON_MANAGE; $this->_conf->show = Privileges::PROJECT_PERSON_SHOW; $this->_conf->edit = 'personproject/edit'; $this->_conf->delete = 'personproject/delete'; $_conf->context = self::CONTEXT_PROJECT; $_conf->manage = Privileges::PROJECT_PERSON_MANAGE; $_conf->show = Privileges::PROJECT_PERSON_SHOW; $_conf->edit = 'personproject/edit'; $_conf->delete = 'personproject/delete'; break; case ActivityOrganization::class: $this->_conf->context = self::CONTEXT_ACTIVITY; $this->_conf->manage = Privileges::ACTIVITY_ORGANIZATION_MANAGE; $this->_conf->show = Privileges::ACTIVITY_ORGANIZATION_SHOW; $this->_conf->edit = 'organizationactivity/edit'; $this->_conf->delete = 'organizationactivity/delete'; $_conf->context = self::CONTEXT_ACTIVITY; $_conf->manage = Privileges::ACTIVITY_ORGANIZATION_MANAGE; $_conf->show = Privileges::ACTIVITY_ORGANIZATION_SHOW; $_conf->edit = 'organizationactivity/edit'; $_conf->delete = 'organizationactivity/delete'; break; case ActivityPerson::class : $this->_conf->context = self::CONTEXT_ACTIVITY; $this->_conf->manage = Privileges::ACTIVITY_PERSON_MANAGE; $this->_conf->show = Privileges::ACTIVITY_PAYMENT_SHOW; $this->_conf->edit = 'personactivity/edit'; $this->_conf->delete = 'personactivity/delete'; $_conf->context = self::CONTEXT_ACTIVITY; $_conf->manage = Privileges::ACTIVITY_PERSON_MANAGE; $_conf->show = Privileges::ACTIVITY_PAYMENT_SHOW; $_conf->edit = 'personactivity/edit'; $_conf->delete = 'personactivity/delete'; break; case OrganizationPerson::class: $this->_conf->context = self::CONTEXT_ORGANIZATION; $this->_conf->manage = Privileges::ORGANIZATION_EDIT; $this->_conf->show = Privileges::ORGANIZATION_SHOW; $_conf->context = self::CONTEXT_ORGANIZATION; $_conf->manage = Privileges::ORGANIZATION_EDIT; $_conf->show = Privileges::ORGANIZATION_SHOW; break; default: throw new OscarException("Objet non-pris en charge"); } } return $this->_conf; return $_conf; } protected function getManagePrivilege($affectation) { Loading Loading
front/src/EntityWithRole.vue +15 −4 Original line number Diff line number Diff line Loading @@ -125,8 +125,9 @@ </span> <div class="form-group" v-else> <label class=" control-label" for="enroled">{{ title }}</label> <personselector @change="handlerEnrolledSelected($event)" v-if="title == 'Personne'" v-model="selectedPerson"/> <organizationselector @change="handlerEnrolledSelected($event)" v-else/> <pre>{{ selected }} / {{ selectedPerson }}</pre> <personselector @change="handlerEnrolledSelectedPerson($event)" v-if="title == 'Personne'" v-model="selected"/> <organizationselector @change="handlerEnrolledSelected($event)" v-else v-model="selected" /> </div> <div class="form-group"> Loading Loading @@ -196,6 +197,8 @@ import OrganizationAutoCompleter from "./components/OrganizationAutoCompleter"; import PersonAutoCompleter from "./components/PersonAutoCompleter"; import Datepicker from "./components/Datepicker"; console.log("FOO"); export default { components: { organizationselector: OrganizationAutoCompleter, Loading @@ -215,6 +218,7 @@ export default { data() { return { selectedPerson: null, selected: null, entities: [], entityEdited: null, entityDelete: null, Loading Loading @@ -245,7 +249,12 @@ export default { }, handlerEnrolledSelected(data) { console.log(data); this.entityNew.enroled = data.id; this.entityNew.enroledLabel = data.label; }, handlerEnrolledSelectedPerson(data) { this.selected = data.id; this.entityNew.enroled = data.id; this.entityNew.enroledLabel = data.label; }, Loading Loading @@ -298,7 +307,8 @@ export default { performNew() { let data = new FormData(); this.loading = "Création..."; var enroled = this.entityNew.enroled; console.log("ENTITYNEW:", JSON.stringify(this.entityNew)); var enroled = this.selected; data.append('dateStart', this.entityNew.start); data.append('dateEnd', this.entityNew.end); data.append('role', this.entityNew.role); Loading Loading @@ -338,6 +348,7 @@ export default { }, mounted() { console.log("MOUNTED"); this.fetch(); } } Loading
module/Oscar/src/Oscar/Controller/EnrollController.php +11 −3 Original line number Diff line number Diff line Loading @@ -116,10 +116,18 @@ class EnrollController extends AbstractOscarController implements UsePersonServi public function organizationProjectDeleteAction() { try { $idenroll = $this->params()->fromRoute('idenroll'); if( !$idenroll ){ throw new OscarException("Identifiant non-trouvé " . $idenroll); } /** @var ProjectPartner $enroll */ $enroll = $this->getEntityManager()->getRepository(ProjectPartner::class)->find( $this->params()->fromRoute('idenroll') ); $enroll = $this->getEntityManager()->getRepository(ProjectPartner::class)->find($idenroll); if( !$enroll ){ throw new OscarException("L'association Organization/Projet est manquante"); } $this->getOscarUserContextService()->check(Privileges::PROJECT_ORGANIZATION_MANAGE, $enroll->getProject()); $this->getProjectService()->removeProjectOrganization($enroll); Loading
module/Oscar/src/Oscar/Controller/ProjectController.php +5 −0 Original line number Diff line number Diff line Loading @@ -238,11 +238,16 @@ class ProjectController extends AbstractOscarController return $this->htmlProjectDetail($entity); } $rolesOrganizations = $this->getOscarUserContextService()->getRolesOrganizationInActivity(); $rolesPersons = $this->getOscarUserContextService()->getAllRoleIdPersonInActivity(); return array( // 'access' => $this->getAccessResolverService()->getProjectAccess($entity), 'project' => $entity, 'documents' => $documents, 'rolesOrganizations' => $rolesOrganizations, 'rolesPersons' => $rolesPersons, 'logs' => $this->getActivityLogService()->projectActivities($entity->getId())->getQuery()->getResult() ); } catch (UnAuthorizedException $e) { Loading
module/Oscar/src/Oscar/Controller/ProjectGrantController.php +4 −0 Original line number Diff line number Diff line Loading @@ -1897,6 +1897,10 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif /** @var Activity $entity */ $entity = $this->getEntityManager()->getRepository(Activity::class)->find($id); if(!$entity){ throw new OscarException("Cette activité n'existe plus/pas"); } // Check access $this->getOscarUserContextService()->check(Privileges::ACTIVITY_SHOW, $entity); Loading
module/Oscar/src/Oscar/Formatter/EnrollToArrayFormatter.php +39 −40 Original line number Diff line number Diff line Loading @@ -78,47 +78,46 @@ class EnrollToArrayFormatter private $_conf; private function getConf($affectation){ if( $this->_conf === null ){ $this->_conf = new \stdClass(); $_conf = new \stdClass(); switch (get_class($affectation) ){ case ProjectPartner::class: $this->_conf->context = self::CONTEXT_PROJECT; $this->_conf->manage = Privileges::PROJECT_ORGANIZATION_MANAGE; $this->_conf->show = Privileges::PROJECT_ORGANIZATION_SHOW; $this->_conf->edit = 'organizationproject/edit'; $this->_conf->delete = 'organizationproject/delete'; $_conf->context = self::CONTEXT_PROJECT; $_conf->manage = Privileges::PROJECT_ORGANIZATION_MANAGE; $_conf->show = Privileges::PROJECT_ORGANIZATION_SHOW; $_conf->edit = 'organizationproject/edit'; $_conf->delete = 'organizationproject/delete'; break; case ProjectMember::class : $this->_conf->context = self::CONTEXT_PROJECT; $this->_conf->manage = Privileges::PROJECT_PERSON_MANAGE; $this->_conf->show = Privileges::PROJECT_PERSON_SHOW; $this->_conf->edit = 'personproject/edit'; $this->_conf->delete = 'personproject/delete'; $_conf->context = self::CONTEXT_PROJECT; $_conf->manage = Privileges::PROJECT_PERSON_MANAGE; $_conf->show = Privileges::PROJECT_PERSON_SHOW; $_conf->edit = 'personproject/edit'; $_conf->delete = 'personproject/delete'; break; case ActivityOrganization::class: $this->_conf->context = self::CONTEXT_ACTIVITY; $this->_conf->manage = Privileges::ACTIVITY_ORGANIZATION_MANAGE; $this->_conf->show = Privileges::ACTIVITY_ORGANIZATION_SHOW; $this->_conf->edit = 'organizationactivity/edit'; $this->_conf->delete = 'organizationactivity/delete'; $_conf->context = self::CONTEXT_ACTIVITY; $_conf->manage = Privileges::ACTIVITY_ORGANIZATION_MANAGE; $_conf->show = Privileges::ACTIVITY_ORGANIZATION_SHOW; $_conf->edit = 'organizationactivity/edit'; $_conf->delete = 'organizationactivity/delete'; break; case ActivityPerson::class : $this->_conf->context = self::CONTEXT_ACTIVITY; $this->_conf->manage = Privileges::ACTIVITY_PERSON_MANAGE; $this->_conf->show = Privileges::ACTIVITY_PAYMENT_SHOW; $this->_conf->edit = 'personactivity/edit'; $this->_conf->delete = 'personactivity/delete'; $_conf->context = self::CONTEXT_ACTIVITY; $_conf->manage = Privileges::ACTIVITY_PERSON_MANAGE; $_conf->show = Privileges::ACTIVITY_PAYMENT_SHOW; $_conf->edit = 'personactivity/edit'; $_conf->delete = 'personactivity/delete'; break; case OrganizationPerson::class: $this->_conf->context = self::CONTEXT_ORGANIZATION; $this->_conf->manage = Privileges::ORGANIZATION_EDIT; $this->_conf->show = Privileges::ORGANIZATION_SHOW; $_conf->context = self::CONTEXT_ORGANIZATION; $_conf->manage = Privileges::ORGANIZATION_EDIT; $_conf->show = Privileges::ORGANIZATION_SHOW; break; default: throw new OscarException("Objet non-pris en charge"); } } return $this->_conf; return $_conf; } protected function getManagePrivilege($affectation) { Loading