Merge add_ui_permission into master

+ set deps to chill-project/main dev-master

Squashed commit of the following:

commit c120c9347606358daec042b0e1e3da83cc260f12
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Mon Sep 14 00:50:50 2015 +0200

    switch to role declaration in code

commit 7fba35356ea9266c43a6f104290103071e1c1755
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Mon Aug 31 23:57:59 2015 +0200

    declare role in chill.available_roles parameter
This commit is contained in:
Julien Fastré 2015-09-20 21:47:52 +02:00
parent f301dbdd17
commit 6b3b176849
3 changed files with 16 additions and 3 deletions

View File

@ -30,6 +30,7 @@ services:
- "@chill.main.security.authorization.helper" - "@chill.main.security.authorization.helper"
tags: tags:
- { name: security.voter } - { name: security.voter }
- { name: chill.role }
chill.report.form.report_type: chill.report.form.report_type:
class: Chill\ReportBundle\Form\ReportType class: Chill\ReportBundle\Form\ReportType

View File

@ -21,13 +21,14 @@ namespace Chill\ReportBundle\Security\Authorization;
use Chill\MainBundle\Security\Authorization\AbstractChillVoter; use Chill\MainBundle\Security\Authorization\AbstractChillVoter;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper; use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\MainBundle\Security\ProvideRoleInterface;
/** /**
* *
* *
* @author Julien Fastré <julien.fastre@champs-libres.coop> * @author Julien Fastré <julien.fastre@champs-libres.coop>
*/ */
class ReportVoter extends AbstractChillVoter class ReportVoter extends AbstractChillVoter implements ProvideRoleInterface
{ {
const CREATE = 'CHILL_REPORT_CREATE'; const CREATE = 'CHILL_REPORT_CREATE';
const SEE = 'CHILL_REPORT_SEE'; const SEE = 'CHILL_REPORT_SEE';
@ -63,4 +64,15 @@ class ReportVoter extends AbstractChillVoter
return $this->helper->userHasAccess($user, $report, $attribute); return $this->helper->userHasAccess($user, $report, $attribute);
} }
public function getRoles()
{
return $this->getSupportedAttributes();
}
public function getRolesWithoutScope()
{
return array();
}
} }

View File

@ -25,9 +25,9 @@
"doctrine/orm": "~2.4", "doctrine/orm": "~2.4",
"doctrine/common": "~2.4", "doctrine/common": "~2.4",
"doctrine/doctrine-bundle": "~1.2", "doctrine/doctrine-bundle": "~1.2",
"chill-project/main": "dev-master@dev", "chill-project/main": "dev-master",
"chill-project/custom-fields": "dev-master@dev", "chill-project/custom-fields": "dev-master@dev",
"chill-project/person": "dev-master@dev", "chill-project/person": "dev-master",
"champs-libres/composer-bundle-migration": "~1.0", "champs-libres/composer-bundle-migration": "~1.0",
"doctrine/doctrine-migrations-bundle": "dev-master@dev", "doctrine/doctrine-migrations-bundle": "dev-master@dev",
"doctrine/migrations": "~1.0@dev" "doctrine/migrations": "~1.0@dev"