private void lookupUsersAndGroups() { PermissionsEntityType pEntityType; if (theentity instanceof TridasObject) { pEntityType = PermissionsEntityType.OBJECT; } else if (theentity instanceof TridasElement) { pEntityType = PermissionsEntityType.ELEMENT; } else if (theentity instanceof TridasMeasurementSeries) { pEntityType = PermissionsEntityType.MEASUREMENT_SERIES; } else if (theentity instanceof TridasDerivedSeries) { pEntityType = PermissionsEntityType.DERIVED_SERIES; } else { Alert.error( "Error", "Permissions information is only available for objects, elements and series"); return; } PermissionsResource resource = new PermissionsResource(); for (WSISecurityUser user : (ArrayList<WSISecurityUser>) Dictionary.getDictionaryAsArrayList("securityUserDictionary")) { if (!user.isIsActive()) continue; resource.addPermission(pEntityType, theentity.getIdentifier().getValue(), user); } for (WSISecurityGroup grp : (ArrayList<WSISecurityGroup>) Dictionary.getDictionaryAsArrayList("securityGroupDictionary")) { resource.addPermission(pEntityType, theentity.getIdentifier().getValue(), grp); } // Query db TellervoResourceAccessDialog dialog = new TellervoResourceAccessDialog(resource); resource.query(); dialog.setVisible(true); if (!dialog.isSuccessful()) { log.error("Error getting permissions info"); Alert.error("Error", "Error getting permissions info"); return; } permsList = resource.getAssociatedResult(); if (tblGroupPerms != null) tblGroupPerms.repaint(); if (tblUserPerms != null) tblUserPerms.repaint(); if (permsList.size() == 0) { Alert.error("Error", "No records found"); return; } }
private void editSelectedUser() { WSISecurityUser user = userTableModel.getSecurityUserAtRow(tblUserPerms.getSelectedRow()); for (WSISecurityUser usr : (ArrayList<WSISecurityUser>) Dictionary.getDictionaryAsArrayList("securityUserDictionary")) { if (usr.getId().equals(user.getId())) { user = usr; break; } } UserUIView userDialog = new UserUIView(null, true, user); userDialog.setVisible(true); }