@Override @Deprecated public <DB extends ODatabaseDocument> DB checkSecurity(final String iResourceGeneric, final int iOperation, final Object... iResourcesSpecific) { final ORule.ResourceGeneric resourceGeneric = ORule.mapLegacyResourceToGenericResource(iResourceGeneric); return checkSecurity(resourceGeneric, iOperation, iResourcesSpecific); }
@Override @Deprecated public <DB extends ODatabaseDocument> DB checkSecurity(final String iResourceGeneric, final int iOperation, final Object iResourceSpecific) { final ORule.ResourceGeneric resourceGeneric = ORule.mapLegacyResourceToGenericResource(iResourceGeneric); if (iResourceSpecific == null || iResourceSpecific.equals("*")) return checkSecurity(resourceGeneric, iOperation, (Object) null); return checkSecurity(resourceGeneric, iOperation, iResourceSpecific); }
@Deprecated @Override public boolean allow(String iResource, int iCRUDOperation) { final String specificResource = ORule.mapLegacyResourceToSpecificResource(iResource); final ORule.ResourceGeneric resourceGeneric = ORule.mapLegacyResourceToGenericResource(iResource); if (specificResource == null || specificResource.equals("*")) return allow(resourceGeneric, null, iCRUDOperation); return allow(resourceGeneric, specificResource, iCRUDOperation); }
@Override @Deprecated public OSecurityRole allow(String iResource, int iOperation) { final String resourceSpecific = ORule.mapLegacyResourceToSpecificResource(iResource); final ORule.ResourceGeneric resourceGeneric = ORule.mapLegacyResourceToGenericResource(iResource); if (resourceSpecific == null || resourceSpecific.equals("*")) return allow(resourceGeneric, null, iOperation); return allow(resourceGeneric, resourceSpecific, iOperation); }
@Override @Deprecated public OSecurityRole checkIfAllowed(String iResource, int iOperation) { final String resourceSpecific = ORule.mapLegacyResourceToSpecificResource(iResource); final ORule.ResourceGeneric resourceGeneric = ORule.mapLegacyResourceToGenericResource(iResource); if (resourceSpecific == null || resourceSpecific.equals("*")) return checkIfAllowed(resourceGeneric, null, iOperation); return checkIfAllowed(resourceGeneric, resourceSpecific, iOperation); }
private void loadOldVersionOfRules(final Map<String, Number> storedRules) { if (storedRules != null) for (Entry<String, Number> a : storedRules.entrySet()) { ORule.ResourceGeneric resourceGeneric = ORule.mapLegacyResourceToGenericResource(a.getKey()); ORule rule = rules.get(resourceGeneric); if (rule == null) { rule = new ORule(resourceGeneric, null, null); rules.put(resourceGeneric, rule); } String specificResource = ORule.mapLegacyResourceToSpecificResource(a.getKey()); if (specificResource == null || specificResource.equals("*")) { rule.grantAccess(null, a.getValue().intValue()); } else { rule.grantAccess(specificResource, a.getValue().intValue()); } } }
@Deprecated @Override public boolean allow(String iResource, int iCRUDOperation) { final String specificResource = ORule.mapLegacyResourceToSpecificResource(iResource); final ORule.ResourceGeneric resourceGeneric = ORule.mapLegacyResourceToGenericResource(iResource); if (specificResource == null || specificResource.equals("*")) return allow(resourceGeneric, null, iCRUDOperation); return allow(resourceGeneric, specificResource, iCRUDOperation); }
@Override @Deprecated public OSecurityRole checkIfAllowed(String iResource, int iOperation) { final String resourceSpecific = ORule.mapLegacyResourceToSpecificResource(iResource); final ORule.ResourceGeneric resourceGeneric = ORule.mapLegacyResourceToGenericResource(iResource); if (resourceSpecific == null || resourceSpecific.equals("*")) return checkIfAllowed(resourceGeneric, null, iOperation); return checkIfAllowed(resourceGeneric, resourceSpecific, iOperation); }
@Deprecated @Override public OSecurityRole revoke(String iResource, int iOperation) { final String specificResource = ORule.mapLegacyResourceToSpecificResource(iResource); final ORule.ResourceGeneric resourceGeneric = ORule.mapLegacyResourceToGenericResource(iResource); if (specificResource == null || specificResource.equals("*")) return revoke(resourceGeneric, null, iOperation); return revoke(resourceGeneric, specificResource, iOperation); }
@Deprecated @Override public boolean hasRule(String iResource) { final String specificResource = ORule.mapLegacyResourceToSpecificResource(iResource); final ORule.ResourceGeneric resourceGeneric = ORule.mapLegacyResourceToGenericResource(iResource); if (specificResource == null || specificResource.equals("*")) return hasRule(resourceGeneric, null); return hasRule(resourceGeneric, specificResource); }
@Override @Deprecated public <DB extends ODatabaseDocument> DB checkSecurity(final String iResource, final int iOperation) { final String resourceSpecific = ORule.mapLegacyResourceToSpecificResource(iResource); final ORule.ResourceGeneric resourceGeneric = ORule.mapLegacyResourceToGenericResource(iResource); if (resourceSpecific == null || resourceSpecific.equals("*")) checkSecurity(resourceGeneric, null, iOperation); return checkSecurity(resourceGeneric, resourceSpecific, iOperation); }
@Override @Deprecated public OSecurityRole allow(String iResource, int iOperation) { final String resourceSpecific = ORule.mapLegacyResourceToSpecificResource(iResource); final ORule.ResourceGeneric resourceGeneric = ORule.mapLegacyResourceToGenericResource(iResource); if (resourceSpecific == null || resourceSpecific.equals("*")) return allow(resourceGeneric, null, iOperation); return allow(resourceGeneric, resourceSpecific, iOperation); }
@Deprecated @Override public OSecurityRole addRule(String iResource, int iOperation) { final String specificResource = ORule.mapLegacyResourceToSpecificResource(iResource); final ORule.ResourceGeneric resourceGeneric = ORule.mapLegacyResourceToGenericResource(iResource); if (specificResource == null || specificResource.equals("*")) return addRule(resourceGeneric, null, iOperation); return addRule(resourceGeneric, specificResource, iOperation); }
@Deprecated @Override public OSecurityRole grant(String iResource, int iOperation) { final String specificResource = ORule.mapLegacyResourceToSpecificResource(iResource); final ORule.ResourceGeneric resourceGeneric = ORule.mapLegacyResourceToGenericResource(iResource); if (specificResource == null || specificResource.equals("*")) return grant(resourceGeneric, null, iOperation); return grant(resourceGeneric, specificResource, iOperation); }
@Override @Deprecated public boolean isRuleDefined(String iResource) { final String resourceSpecific = ORule.mapLegacyResourceToSpecificResource(iResource); final ORule.ResourceGeneric resourceGeneric = ORule.mapLegacyResourceToGenericResource(iResource); if (resourceSpecific == null || resourceSpecific.equals("*")) return isRuleDefined(resourceGeneric, null); return isRuleDefined(resourceGeneric, resourceSpecific); }
@Deprecated @Override public boolean hasRule(String iResource) { final String specificResource = ORule.mapLegacyResourceToSpecificResource(iResource); final ORule.ResourceGeneric resourceGeneric = ORule.mapLegacyResourceToGenericResource(iResource); if (specificResource == null || specificResource.equals("*")) return hasRule(resourceGeneric, null); return hasRule(resourceGeneric, specificResource); }
@Override @Deprecated public boolean isRuleDefined(String iResource) { final String resourceSpecific = ORule.mapLegacyResourceToSpecificResource(iResource); final ORule.ResourceGeneric resourceGeneric = ORule.mapLegacyResourceToGenericResource(iResource); if (resourceSpecific == null || resourceSpecific.equals("*")) return isRuleDefined(resourceGeneric, null); return isRuleDefined(resourceGeneric, resourceSpecific); }
/** * Transform name to {@link ORule.ResourceGeneric} * @param name name to transform * @return {@link ORule.ResourceGeneric} or null */ public static ORule.ResourceGeneric getResourceGeneric(String name) { String shortName = Strings.beforeFirst(name, '.'); if(Strings.isEmpty(shortName)) shortName = name; ORule.ResourceGeneric value = ORule.ResourceGeneric.valueOf(shortName); if(value==null) value = ORule.mapLegacyResourceToGenericResource(name); return value; }
/** * Transform name to {@link ORule.ResourceGeneric} * @param name name to transform * @return {@link ORule.ResourceGeneric} or null */ public static ORule.ResourceGeneric getResourceGeneric(String name) { String shortName = Strings.beforeFirst(name, '.'); if(Strings.isEmpty(shortName)) shortName = name; ORule.ResourceGeneric value = ORule.ResourceGeneric.valueOf(shortName); if(value==null) value = ORule.mapLegacyResourceToGenericResource(name); return value; }