/** * CSPACE-2894 make permission names match the UI names when the app sends the data to the UI * * @param spec * @param servicename * @return */ public static String ResourceNameUI(Spec spec, String servicename) { try { Record test = null; // can we do a simple match if (spec.hasRecord(servicename)) { test = spec.getRecord(servicename); } else if (spec.hasRecordByServicesUrl(servicename)) { test = spec.getRecordByServicesUrl(servicename); } else { // else loop thr the records and see if we can do an auth match for (Record r : spec.getAllRecords()) { if (r.isAuthorizationType(servicename)) { test = r; } } } return test.getWebURL(); } catch (Exception e) { return servicename; } }
public static String getPermissionView(Spec spec, String servicename) { try { Record test = null; // can we do a simple match if (spec.hasRecordByServicesUrl(servicename)) { test = spec.getRecordByServicesUrl(servicename); } else { // else loop thr the records and see if we can do an auth match for (Record r : spec.getAllRecords()) { if (r.isAuthorizationType(servicename)) { test = r; } } } if (test.getAuthorizationView()) { return "show"; } return "none"; } catch (Exception e) { // do not display as we don't know what this is return "none"; } }
public void configure(WebUI ui, Spec spec) { for (Record r : spec.getAllRecords()) { type_to_url.put(r.getID(), r.getWebURL()); } }