예제 #1
0
  /**
   * This method initializes the view by populating all the entities. It fetches the role itself,
   * the type of authorization update support and all the assigned principals. It then populates a
   * list of unassigned principals.
   */
  protected void initialize(String roleName) throws Exception {
    this.infoGlueRole = RoleControllerProxy.getController().getRole(roleName);
    this.supportsUpdate = this.infoGlueRole.getAutorizationModule().getSupportUpdate();
    this.availableSystemUserCount =
        UserControllerProxy.getTableCount("cmSystemUser", "userName").getCount();
    if (this.supportsUpdate) {
      this.assignedInfoGluePrincipals =
          this.infoGlueRole.getAutorizationModule().getRoleUsers(roleName);
      if (availableSystemUserCount < 10000) {
        this.infoGluePrincipals = this.infoGlueRole.getAutorizationModule().getUsers();
        // this.supportsUpdate				= RoleControllerProxy.getController().getSupportUpdate();
        if (this.supportsUpdate) // Only fetch if the user can edit.
        {
          List newInfogluePrincipals = new ArrayList();
          newInfogluePrincipals.addAll(this.infoGluePrincipals);
          newInfogluePrincipals.removeAll(assignedInfoGluePrincipals);
          this.unassignedInfoGluePrincipals = newInfogluePrincipals;
        }
      }
    }

    this.contentTypeDefinitionVOList =
        ContentTypeDefinitionController.getController()
            .getContentTypeDefinitionVOList(ContentTypeDefinitionVO.EXTRANET_ROLE_PROPERTIES);
    this.assignedContentTypeDefinitionVOList =
        RolePropertiesController.getController().getContentTypeDefinitionVOList(roleName);
  }
예제 #2
0
  protected String doExecute() throws Exception {
    ceb.add(this.roleVO.validate());
    ceb.throwIfNotEmpty();

    String[] userNames = getRequest().getParameterValues("userName");
    String[] contentTypeDefinitionIds = getRequest().getParameterValues("contentTypeDefinitionId");

    RoleControllerProxy.getController().createRole(this.roleVO);
    if (userNames != null) {
      RoleControllerProxy.getController().updateRole(this.roleVO, userNames);
    }

    if (contentTypeDefinitionIds != null
        && contentTypeDefinitionIds.length > 0
        && !contentTypeDefinitionIds[0].equals(""))
      RolePropertiesController.getController()
          .updateContentTypeDefinitions(this.getRoleName(), contentTypeDefinitionIds);

    return "success";
  }