Package org.palo.viewapi

Examples of org.palo.viewapi.Role


        List <String> roleIds = new ArrayList<String>();
        List <String> roleNames = new ArrayList<String>();
        IRoleManagement rm = MapperRegistry.getInstance().getRoleManagement();
        if (isPublic) {
          try {
            Role r = (Role) rm.findByName("VIEWER");
            roleIds.add(r.getId());
            roleNames.add(r.getName());
          } catch (Throwable t) {
          }
        }
        if (isEditable) {
          try {
            Role r = (Role) rm.findByName("EDITOR");
            roleIds.add(r.getId());
            roleNames.add(r.getName());
          } catch (Throwable t) {
          }
        }
        importedXView.setRoleIds(roleIds);
        importedXView.setRoleNames(roleNames);       
View Full Code Here


    List <String> roleIds = new ArrayList<String>();
    List <String> roleNames = new ArrayList<String>();
    IRoleManagement rm = MapperRegistry.getInstance().getRoleManagement();
    try {
      Role r = (Role) rm.findByName("VIEWER");
      roleIds.add(r.getId());
      roleNames.add(r.getName());
    } catch (Throwable t) {
    }
    try {
      Role r = (Role) rm.findByName("EDITOR");
      roleIds.add(r.getId());
      roleNames.add(r.getName());
    } catch (Throwable t) {
    }
    importedXView.setRoleIds(roleIds);
    importedXView.setRoleNames(roleNames);       
    //saves xml definition in spagobi
View Full Code Here

  }
 
  private final void assignViewerAndEditorRole(String sessionId, FolderElement fe, View view,
      boolean isPublic, boolean isEditable) throws SQLException {
    IRoleManagement roleMgmt = MapperRegistry.getInstance().getRoleManagement();
    Role viewerRole = (Role) roleMgmt.findByName("VIEWER");
    if (viewerRole == null) {
      viewerRole = new RoleImpl.Builder(null).name("VIEWER").
      permission(Right.READ).build();
      roleMgmt.insert(viewerRole);
    }
    Role editorRole = (Role) roleMgmt.findByName("EDITOR");
    if (editorRole == null) {
      editorRole = new RoleImpl.Builder(null).name("EDITOR").
        permission(Right.CREATE).build();
      roleMgmt.insert(editorRole);
    }
View Full Code Here

   
  private final void saveRoot(String sessionId, ExplorerTreeNode root) throws SessionExpiredException {
    try {
      AuthUser user = getLoggedInUser(sessionId);
      FolderService folderService = ServiceProvider.getFolderService(user);   
      Role viewerRole = null;
      for (Role role: user.getRoles()) {
        if (role.getName().equalsIgnoreCase("viewer")) {
          viewerRole = role;
          break;
        }
View Full Code Here

  }
 
  private final XObject[] getRoles(List<Role> roles) {
    XObject[] ret = new XObject[roles.size()];
    for(int i=0;i<ret.length;++i) {
      Role role = roles.get(i);
      ret[i] = (XRole) XConverter.createX(role);
//      ret[i] = (XRole) WPaloAdminCache.getXObject(role); //XConverter.createRole(role);
//      WPaloAdminCache.add(ret[i], role);
    }
    return ret;
View Full Code Here

  }

  private final void assignViewerAndEditorRole(String sessionId, FolderElement fe, View view,
      boolean isPublic, boolean isEditable) throws SQLException {
    IRoleManagement roleMgmt = MapperRegistry.getInstance().getRoleManagement();
    Role viewerRole = (Role) roleMgmt.findByName("VIEWER");
    if (viewerRole == null) {
      viewerRole = new RoleImpl.Builder(null).name("VIEWER").
      permission(Right.READ).build();
      roleMgmt.insert(viewerRole);
    }
    Role editorRole = (Role) roleMgmt.findByName("EDITOR");
    if (editorRole == null) {
      editorRole = new RoleImpl.Builder(null).name("EDITOR").
        permission(Right.CREATE).build();
      roleMgmt.insert(editorRole);
    }
View Full Code Here

 
  private final void saveRoot(String sessionId, ExplorerTreeNode root) throws SessionExpiredException {
    try {
      AuthUser user = getLoggedInUser(sessionId);
      FolderService folderService = ServiceProvider.getFolderService(user);   
      Role viewerRole = null;
      for (Role role: user.getRoles()) {
        if (role.getName().equalsIgnoreCase("viewer")) {
          viewerRole = role;
          break;
        }
View Full Code Here

        viewApiUser = admin;
      } else {
        viewApiUser = admService.createUser("", "", user, pass);
        admService.save(viewApiUser);
      }         
      Role viewerRole = admService.getRoleByName("VIEWER");
      Role editorRole = admService.getRoleByName("EDITOR");
      IUserRoleManagement urAssoc = MapperRegistry.getInstance().getUserRoleAssociation();       
      urAssoc.insert(viewApiUser, viewerRole);
      urAssoc.insert(viewApiUser, editorRole);
      admService.add(viewerRole, viewApiUser);
      admService.add(editorRole, viewApiUser);
View Full Code Here

          viewApiUser = admin;
        } else {
          viewApiUser = admService.createUser("", "", user, pass);
          admService.save(viewApiUser);
        }         
        Role viewerRole = admService.getRoleByName("VIEWER");
        Role editorRole = admService.getRoleByName("EDITOR");
        IUserRoleManagement urAssoc = MapperRegistry.getInstance().getUserRoleAssociation();       
        urAssoc.insert(viewApiUser, viewerRole);
        urAssoc.insert(viewApiUser, editorRole);
        admService.add(viewerRole, viewApiUser);
        admService.add(editorRole, viewApiUser);
View Full Code Here

TOP

Related Classes of org.palo.viewapi.Role

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.