Пример #1
0
 /**
  * @EXT\Route(
  *     "/model/{model}/retrieve/roles/translation/keys",
  *     name="ws_model_roles_translation_keys_retrieve",
  *     options={"expose"=true}
  * )
  * @EXT\ParamConverter("user", options={"authenticatedUser" = true})
  */
 public function retrieveRolesTranslationKeysFromWorkspaceModel(WorkspaceModel $model, User $user)
 {
     $users = $model->getUsers()->toArray();
     if (!in_array($user, $users)) {
         throw new AccessDeniedException();
     }
     $results = array();
     $workspace = $model->getWorkspace();
     $roles = $this->roleManager->getRolesByWorkspace($workspace);
     foreach ($roles as $role) {
         $results[] = $role->getTranslationKey();
     }
     return new JsonResponse($results);
 }
Пример #2
0
 public function addDataFromModel(WorkspaceModel $model, Workspace $workspace, User $user, &$errors)
 {
     $modelWorkspace = $model->getWorkspace();
     $resourcesModels = $model->getResourcesModel();
     $homeTabs = $model->getHomeTabs();
     $resourcesInfos = array();
     $this->duplicateWorkspaceRoles($modelWorkspace, $workspace, $user);
     $this->duplicateOrderedTools($modelWorkspace, $workspace);
     $rootDirectory = $this->duplicateRootDirectory($modelWorkspace, $workspace, $user);
     $errors['resourceErrors'] = $this->duplicateResources($resourcesModels->toArray(), $rootDirectory, $workspace, $user, $resourcesInfos);
     $this->om->forceFlush();
     $errors['widgetConfigErrors'] = $this->duplicateHomeTabs($modelWorkspace, $workspace, $homeTabs->toArray(), $resourcesInfos);
 }
 /**
  * Currently only set the tools permissions.
  */
 public function updateDataFromModel(WorkspaceModel $model, Workspace $workspace)
 {
     $this->duplicateOrderedTools($model->getWorkspace(), $workspace);
 }