Example #1
0
 private function loadDefaultAuthorizatorRules(ObjectManager $manager)
 {
     // privileges
     $silence = new Privilege('silence');
     $manager->persist($silence);
     $release = new Privilege('release');
     $manager->persist($release);
     $viewSilenced = new Privilege('view_silenced');
     $manager->persist($viewSilenced);
     $respondOnSilenced = new Privilege('respond_on_silenced');
     $manager->persist($respondOnSilenced);
     $commentOnClosed = new Privilege('comment_on_closed');
     $manager->persist($commentOnClosed);
     $arg = new AuthorizationRulesGenerator(new Resource('page'), $manager);
     $arg->addDefinition($this->getReference('privilege_create'), $this->getReference('role_admin'))->addDefinition($this->getReference('privilege_edit'), $this->getReference('role_admin'))->addDefinition($this->getReference('privilege_remove'), $this->getReference('role_admin'));
     // comments
     $arg->addResource(new Resource('page_comment'))->addDefinition($silence, $this->getReference('role_admin'))->addDefinition($release, $this->getReference('role_admin'))->addDefinition($this->getReference('privilege_remove'), $this->getReference('role_admin'))->addDefinition($viewSilenced, $this->getReference('role_admin'))->addDefinition($respondOnSilenced, $this->getReference('role_admin'));
     // page_comment_form
     $arg->addResource(new Resource('page_comment_form'))->addDefinition($commentOnClosed, $this->getReference('role_admin'));
     // tags
     $arg->addResource(new Resource('page_tag'))->addDefinition($this->getReference('privilege_create'), $this->getReference('role_admin'))->addDefinition($this->getReference('privilege_edit'), $this->getReference('role_admin'))->addDefinition($this->getReference('privilege_remove'), $this->getReference('role_admin'));
 }
Example #2
0
 private function loadDefaultAuthorizatorRules(ObjectManager $manager)
 {
     $arg = new AuthorizationRulesGenerator(new Resource('user'), $manager);
     $arg->addDefinition($this->getReference('privilege_edit'), $this->getReference('role_admin'))->addDefinition($this->getReference('privilege_remove'), $this->getReference('role_admin'));
     $arg->addResource(new Resource('user_role'))->addDefinition($this->getReference('privilege_create'), $this->getReference('role_admin'))->addDefinition($this->getReference('privilege_edit'), $this->getReference('role_admin'))->addDefinition($this->getReference('privilege_remove'), $this->getReference('role_admin'));
 }