public Collection<Grant> getGrants(){ return this.store.getGrants(); }
private void processGrants(MetadataStore store, Map<String, DataPolicyMetadata> policies) { if (store.getGrants() == null || store.getGrants().isEmpty() || policies == null) { return; } for (Grant grant : store.getGrants()) { DataPolicyMetadata dpm = policies.get(grant.getRole()); if (dpm != null) { for (Permission p:grant.getPermissions()) { PermissionMetaData pmd = DatabaseUtil.convert(p); if (pmd != null) { dpm.addPermission(pmd); } } } else { LogManager.logDetail(LogConstants.CTX_RUNTIME, "Permission added to non-existant role", grant.getRole()); //$NON-NLS-1$ } } }
private void processGrants(MetadataStore store, Map<String, DataPolicyMetadata> policies) { if (store.getGrants() == null || store.getGrants().isEmpty() || policies == null) { return; } for (Grant grant : store.getGrants()) { DataPolicyMetadata dpm = policies.get(grant.getRole()); if (dpm != null) { for (Permission p:grant.getPermissions()) { PermissionMetaData pmd = DatabaseUtil.convert(p); if (pmd != null) { dpm.addPermission(pmd); } } } else { LogManager.logDetail(LogConstants.CTX_RUNTIME, "Permission added to non-existant role", grant.getRole()); //$NON-NLS-1$ } } }
private void processGrants(MetadataStore store, Map<String, DataPolicyMetadata> policies) { if (store.getGrants() == null || store.getGrants().isEmpty() || policies == null) { return; } for (Grant grant : store.getGrants()) { DataPolicyMetadata dpm = policies.get(grant.getRole()); if (dpm != null) { for (Permission p:grant.getPermissions()) { PermissionMetaData pmd = DatabaseUtil.convert(p); if (pmd != null) { dpm.addPermission(pmd); } } } else { LogManager.logDetail(LogConstants.CTX_RUNTIME, "Permission added to non-existant role", grant.getRole()); //$NON-NLS-1$ } } }
public void removeRole(String roleName) { Role r = this.store.getRole(roleName); if (r == null) { throw new MetadataException(DataPlugin.Event.TEIID60029, DataPlugin.Util.gs(DataPlugin.Event.TEIID60029, roleName)); } else { // make sure it is not used in any grants for (Grant g:this.store.getGrants()) { if (g.getRole().equalsIgnoreCase(roleName)) { throw new MetadataException(DataPlugin.Event.TEIID60030, DataPlugin.Util.gs(DataPlugin.Event.TEIID60030, roleName, g.getPermissions().iterator().next().getResourceName(), g.getPermissions().iterator().next().getResourceType().name())); } } this.store.removeRole(roleName); } }