Package org.palo.viewapi.services

Examples of org.palo.viewapi.services.AdministrationService


    AuthUser admin = userSession.getUser();
    if(admin == null)
      return new XObject[0];
   
    String type = parent.getType();   
    AdministrationService adminService =
      ServiceProvider.getAdministrationService(admin);
   
    XObject[] ret;
   
    if(type.equals(XConstants.TYPE_ACCOUNTS_NODE))
View Full Code Here


    }
    return xRoles.toArray(new XRole[0]);
  }

  public Boolean [] hasRoles(String sessionId, XUser xuser, String [] roles) throws SessionExpiredException {
    AdministrationService adminService = ServiceProvider
        .getAdministrationService(getLoggedInUser(sessionId));
    Boolean [] result = new Boolean[roles.length];
    for (int i = 0; i < roles.length; i++) {
      result[i] = false;
    }
    User user = getNative(sessionId, xuser);
    for (Role r: adminService.getRoles(user)) {
      for (int i = 0; i < roles.length; i++) {
        if (r.getName().equalsIgnoreCase(roles[i])) {
          result[i] = true;
        }
      }
    }
    for (Group g: adminService.getGroups(user)) {
      for (Role r: g.getRoles()) {
        for (int i = 0; i < roles.length; i++) {
          if (r.getName().equalsIgnoreCase(roles[i])) {
            result[i] = true;
          }
View Full Code Here

    }
    return result;
  }

  public XUser[] getUsers(String sessionId) throws SessionExpiredException {
    AdministrationService adminService = ServiceProvider
        .getAdministrationService(getLoggedInUser(sessionId));
    List<XUser> xUsers= new ArrayList<XUser>();
    for(User usr : adminService.getUsers()) {
      XUser xUser = (XUser)XConverter.createX(usr);
      xUsers.add(xUser);
    }
    return xUsers.toArray(new XUser[0]);
    //TODO throw exception or return empty array !?!?!?
View Full Code Here

    return xUsers.toArray(new XUser[0]);
    //TODO throw exception or return empty array !?!?!?
  }

  public Boolean hasAccount(String sessionId, XConnection con) throws SessionExpiredException {
    AdministrationService adminService = ServiceProvider.
      getAdministrationService(getLoggedInUser(sessionId));
    for (Account acc: adminService.getAccounts()) {
      if (acc.getConnection() != null && acc.getConnection().getId().equals(con.getId())) {
        return true;
      }
    }
    return false;
View Full Code Here

    if (acc != null) {
      if (acc.getUser() != null) {
        if (acc.getUser().getId().equals(user.getId())) {
          // This account needs to be changed.
          AuthUser admin = getLoggedInUser(sessionId);
          AdministrationService admService = ServiceProvider.getAdministrationService(admin);         
          User admUser = admService.getUser(admin.getId());         
          if (!admUser.getId().equals(user.getId())) {
            for (Account a: admService.getAccounts(admUser)) {
              if (a.getConnection().getId().equals(acc.getConnection().getId())) {
                return a;
              }
            }
          }
View Full Code Here

      throw new DbOperationFailedException(userSession.translate("couldNotDelete", xObj.getName(), message), e);
    }
  }
 
  private final Account getNative(String sessionId, XAccount xAccount) throws SessionExpiredException {
    AdministrationService adminService = ServiceProvider
        .getAdministrationService(getLoggedInUser(sessionId));
    return adminService.getAccount(xAccount.getId());
  }
View Full Code Here

        .getAdministrationService(getLoggedInUser(sessionId));
    return adminService.getAccount(xAccount.getId());
  }

  private final PaloConnection getNative(String sessionId, XConnection xConnection) throws SessionExpiredException {
    AdministrationService adminService = ServiceProvider
        .getAdministrationService(getLoggedInUser(sessionId));
    return adminService.getConnection(xConnection.getId());
  }
View Full Code Here

        .getAdministrationService(getLoggedInUser(sessionId));
    return adminService.getConnection(xConnection.getId());
  }

  private final Group getNative(String sessionId, XGroup xGroup) throws SessionExpiredException {
    AdministrationService adminService = ServiceProvider
        .getAdministrationService(getLoggedInUser(sessionId));
    return adminService.getGroup(xGroup.getId());
  }
View Full Code Here

   
    AuthUser admin = userSession.getUser();
    if(admin == null)
      return new XObject[0];
       
    AdministrationService adminService =
      ServiceProvider.getAdministrationService(admin);
   
    XObject[] ret;
    if(type.equals(XConstants.TYPE_USERS_NODE))
      ret = getUsers(adminService); //.getUsers());
    else if (type.equals(XConstants.TYPE_GROUPS_NODE))
      ret = getGroups(adminService.getGroups());
    else if (type.equals(XConstants.TYPE_ROLES_NODE))
      ret = getRoles(adminService.getRoles());
    else
      ret = new XObject[0];
   
    return ret;
  }
View Full Code Here

        .getAdministrationService(getLoggedInUser(sessionId));
    return adminService.getGroup(xGroup.getId());
  }

  private final Role getNative(String sessionId, XRole xRole) throws SessionExpiredException {
    AdministrationService adminService = ServiceProvider
        .getAdministrationService(getLoggedInUser(sessionId));
    return adminService.getRole(xRole.getId());
  }
View Full Code Here

TOP

Related Classes of org.palo.viewapi.services.AdministrationService

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.