Commit f3e3c082 authored by Stéphane Bouvry's avatar Stéphane Bouvry
Browse files

TRAVAUX EN COURS - INSTABLE !

parent 967c2397
Loading
Loading
Loading
Loading
+15 −13
Changes for module/Oscar/config/module.config.php: 15 added lines, 13 removed lines.
Original line number Diff line number Diff line
@@ -36,23 +36,19 @@ return array(
                    'action' => ['documentation', 'parameters'],
                    'roles' => ['user'],
                ],
                [ 'controller' =>  'Public',
                    'action' => ['testCalendar'],
                    'roles' => ['user'],
                ],

                [ 'controller' =>  'Notification',
                    'action' => ['indexPerson', 'index', 'test'],
                    'roles' => ['user'],
                ],

                [ 'controller' =>  'Notification',
                    'action' => ['notifyPerson', 'history'],
                    'action' => ['indexPerson', 'index', 'test',
                        'notifyPerson', 'history'],
                    'roles' => ['user'],
                ],

                [ 'controller' =>  'Administration',
                    'action' => ['users', 'roles', 'rolesEdit', "index", "accessAPI", "roleAPI", "userLogs", 'userRoles', 'organizationRole', 'organizationRoleApi', 'activityIndexBuild', 'organizationType', 'discipline'],
                    'action' => ['users', 'roles', 'rolesEdit',
                        "index", "accessAPI", "roleAPI",
                        "userLogs", 'userRoles', 'organizationRole',
                        'organizationRoleApi', 'activityIndexBuild', 'organizationType',
                        'discipline'],
                    'roles' => ['user']
                ],

@@ -209,8 +205,9 @@ return array(
                        'indexPersonActivity', 'sauvegarde', 'declaration', 'validations', 'resume',
                        "declaration2", "indexActivity", "validateTimesheet",
                        'usurpation', 'excel', 'organizationLeader',
                        'declarant', 'declarantAPI', 'validationActivity', 'validationActivity2',
                        'validationHWPPerson', 'validatePersonPeriod', 'importIcal', 'declarations'
                        'declarant', 'declarantAPI', 'validationActivity',
                        'validationActivity2', 'validationHWPPerson', 'validatePersonPeriod',
                        'importIcal', 'declarations', 'resumeActivity'
                    ],
                    'roles' => ['user']
                ],
@@ -242,6 +239,11 @@ return array(
                    'action' => ['edit', 'new', 'syncLdap', 'merge', 'organizationRole', 'notificationPerson', 'notificationPersonGenerate'],
                    'privileges' => \Oscar\Provider\Privileges::PERSON_EDIT
                ],
                [ 'controller' =>   'Person',
                    'action' => ['grant'],
                    'privileges' => \Oscar\Provider\Privileges::DROIT_PRIVILEGE_VISUALISATION
                ],

                // Membre
                [ 'controller' =>   'Enroll',
                    'action' => ['personProjectNew', 'personProjectDelete', 'personProjectEdit'],
+13 −1
Changes for module/Oscar/config/routes.yml: 13 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -78,7 +78,12 @@ timesheet:
            controller: Timesheet
    may_terminate: false
    child_routes:

        activity:
            type: segment
            options:
                route: /resume-activity/:id
                defaults:
                    action: resumeActivity
        resume:
            type: segment
            options:
@@ -429,6 +434,13 @@ person:
                defaults:
                    action: show

        grant:
            type: segment
            options:
                route: '/grant/:id'
                defaults:
                    action: grant

        notification:
            type: segment
            options:
+24 −0
Changes for module/Oscar/src/Oscar/Controller/PersonController.php: 24 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -50,6 +50,30 @@ class PersonController extends AbstractOscarController
        $this->getResponseDeprecated();
    }

    public function grantAction()
    {
        $this->getOscarUserContext()->check(Privileges::DROIT_PRIVILEGE_VISUALISATION);
        $person = $this->getPersonService()->getPerson($this->params()->fromRoute('id'));

        $organizations = [];

        /** @var OrganizationPerson $personOrganization */
        foreach( $person->getOrganizations() as $personOrganization ){
            $organizations[$personOrganization->getOrganization()->getId()] = [
                'rôles' => $this->getOscarUserContext()->getRolesPersonInOrganization($person, $personOrganization->getOrganization()),
                'privileges' => $this->getOscarUserContext()->getPersonPrivilegesInOrganization($person, $personOrganization->getOrganization())
            ];

        }

        var_dump($organizations);

        //$userCOntext = $this->getOscarUserContext()->getPri
        return [
            'person' => $person
        ];
    }

    public function viewsAction()
    {
        $view = $this->params()->fromQuery('view', 'almoststart');
+24 −2
Changes for module/Oscar/src/Oscar/Controller/TimesheetController.php: 24 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -1043,12 +1043,34 @@ class TimesheetController extends AbstractOscarController
        die("DESACTIVE");
    }

    public function resumeActivityAction(){

        $activity = $this->getEntityManager()->getRepository(Activity::class)->find($this->params()->fromRoute('id'));
        $method = $this->getHttpXMethod();

        if( $this->isAjax() ){
            switch ($method) {
                case 'GET' :
                    $datas = $this->getTimesheetService()->getResumeActivity($activity);
                    return $this->ajaxResponse($datas);
            }
        }
        return [];
    }

    public function resumeAction(){

        $personId = $this->params()->fromQuery('person_id', null);
        if( $personId ){
            $person = $this->getPersonService()->getPerson($personId);
        } else {
            $person = $this->getCurrentPerson();
        }

        return [
            'datas' => $this->getTimesheetService()->getResumePerson($this->getCurrentPerson())
            'datas' => $this->getTimesheetService()->getResumePerson($person),
            'person' => $personId ? $person : null
        ];

    }

    public function validationsAction() {
+19 −0
Changes for module/Oscar/src/Oscar/Entity/Activity.php: 19 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -1962,6 +1962,25 @@ class Activity implements ResourceInterface
        return false;
    }

    /**
     * @return Person[]
     */
    public function getDeclarers(){
        $persons = [];

        /** @var WorkPackage $workPackage */
        foreach ($this->getWorkPackages() as $workPackage){
            /** @var WorkPackagePerson $workPackagePerson */
            foreach ($workPackage->getPersons() as $workPackagePerson) {
                if( !array_key_exists($workPackagePerson->getPerson()->getId(), $persons) ){
                    $persons[$workPackagePerson->getPerson()->getId()] = $workPackagePerson->getPerson();
                }
            }
        }

        return $persons;
    }

    public function getTimesheets(){
        $timesheets = [];
        /** @var WorkPackage $workPackage */
Loading