mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-25 17:04:54 +00:00
This commit is contained in:
parent
b7e3242911
commit
786dde170e
@ -68,7 +68,6 @@ import org.openmetadata.service.resources.EntityResource;
|
|||||||
import org.openmetadata.service.security.Authorizer;
|
import org.openmetadata.service.security.Authorizer;
|
||||||
import org.openmetadata.service.security.policyevaluator.CompiledRule;
|
import org.openmetadata.service.security.policyevaluator.CompiledRule;
|
||||||
import org.openmetadata.service.security.policyevaluator.RuleEvaluator;
|
import org.openmetadata.service.security.policyevaluator.RuleEvaluator;
|
||||||
import org.openmetadata.service.util.JsonUtils;
|
|
||||||
import org.openmetadata.service.util.ResultList;
|
import org.openmetadata.service.util.ResultList;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -107,23 +106,6 @@ public class PolicyResource extends EntityResource<Policy, PolicyRepository> {
|
|||||||
repository.initSeedDataFromResources();
|
repository.initSeedDataFromResources();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void upgrade() throws IOException {
|
|
||||||
// Introduced in 0.13
|
|
||||||
// OrganizationPolicy rule change
|
|
||||||
Policy originalOrgPolicy = repository.getByName(null, Entity.ORGANIZATION_POLICY_NAME, repository.getPatchFields());
|
|
||||||
Policy updatedOrgPolicy = JsonUtils.readValue(JsonUtils.pojoToJson(originalOrgPolicy), Policy.class);
|
|
||||||
|
|
||||||
// Rules are in alphabetical order - change second rule "OrganizationPolicy-Owner-Rule"
|
|
||||||
// from ALL operation to remove CREATE operation and allow all the other operations for the owner
|
|
||||||
updatedOrgPolicy
|
|
||||||
.getRules()
|
|
||||||
.get(1)
|
|
||||||
.withOperations(List.of(MetadataOperation.EDIT_ALL, MetadataOperation.VIEW_ALL, MetadataOperation.DELETE));
|
|
||||||
repository.patch(
|
|
||||||
null, originalOrgPolicy.getId(), "admin", JsonUtils.getJsonPatch(originalOrgPolicy, updatedOrgPolicy));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class PolicyList extends ResultList<Policy> {
|
public static class PolicyList extends ResultList<Policy> {
|
||||||
/* Required for serde */
|
/* Required for serde */
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user