Example #1
0
 private final void setRoles(final List<String> roleIDs) {
   Workbench wb = (Workbench) Registry.get(Workbench.ID);
   XUser admin = wb.getUser();
   if (admin != null) {
     WPaloAdminServiceProvider.getInstance()
         .getRoles(
             admin.getSessionId(),
             admin,
             new Callback<XRole[]>(constants.loadingAllRolesFailed()) {
               public void onSuccess(XRole[] roles) {
                 for (XRole role : roles) {
                   boolean check = roleIDs.contains(role.getId());
                   String rightName = constants.none();
                   String p = role.getPermission();
                   if (p.equals("R")) rightName = constants.read();
                   else if (p.equals("W")) rightName = constants.write();
                   else if (p.equals("D")) rightName = constants.delete();
                   else if (p.equals("C")) rightName = constants.create();
                   else if (p.equals("G")) rightName = constants.grant();
                   TableItem item =
                       new TableItem(
                           new Object[] {
                             check, role.getName(),
                             rightName, translateDescription(role.getDescription())
                           });
                   item.setData(ROLE_DATA, role);
                   rolesTable.add(item);
                 }
               }
             });
   }
 }
Example #2
0
 private final void setUsers(final List<String> userIDs) {
   Workbench wb = (Workbench) Registry.get(Workbench.ID);
   // XUser admin = wb.getUser();
   // if (admin != null) {
   WPaloAdminServiceProvider.getInstance()
       .getUsers(
           wb.getUser().getSessionId(),
           new Callback<XUser[]>(constants.loadingAllUsersFailed()) {
             public void onSuccess(XUser[] users) {
               for (XUser user : users) {
                 boolean check = userIDs.contains(user.getId());
                 TableItem item = new TableItem(new Object[] {check, user.getLogin()});
                 item.setData(MEMBER_DATA, user);
                 membersTable.add(item);
               }
             }
           });
   // }
 }