示例#1
0
 public function createPlatformRoleAction($translationKey)
 {
     $role = new Role();
     $role->setType($translationKey);
     $role->setName('ROLE_' . strtoupper($translationKey));
     $role->setTranslationKey($translationKey);
     $role->setReadOnly(false);
     $role->setType(Role::PLATFORM_ROLE);
     $this->om->persist($role);
     $this->om->flush();
     $this->container->get('claroline.manager.profile_property_manager')->addDefaultProperties();
     return $role;
 }
 protected static function createRole($name, Workspace $workspace = null)
 {
     $role = new Role();
     $role->setName($name);
     $role->setTranslationKey($name);
     $role->setType(Role::PLATFORM_ROLE);
     if ($workspace) {
         $role->setType(Role::WS_ROLE);
         $role->setWorkspace($workspace);
     }
     self::create($name, $role);
 }