Skip to content
Snippets Groups Projects

System Tenant Changes for creating system schemas

Open Deepa Kumari requested to merge az/dk-system-tenant-changes into master
Files
7
package org.opengroup.osdu.schema.security;
import org.opengroup.osdu.core.common.model.http.DpsHeaders;
import org.opengroup.osdu.core.common.provider.interfaces.IAuthorizationService;
import org.opengroup.osdu.schema.constants.SchemaConstants;
import org.opengroup.osdu.schema.provider.interfaces.authorization.SystemPartitionAuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
@Component
@Primary
public class AzSystemPartitionAuthServiceImpl implements SystemPartitionAuthService {
@Autowired
private DpsHeaders headers;
@Autowired
private IAuthorizationService entitlementsService;
@Override
public boolean hasSystemLevelPermissions() {
headers.put(SchemaConstants.DATA_PARTITION_ID, SchemaConstants.SYSTEM_PARTITION_NAME);
String user = entitlementsService
.authorizeAny(headers, SchemaConstants.ENTITLEMENT_SERVICE_SYSTEM_SCHEMA_EDITORS)
.getUser();
headers.put(DpsHeaders.USER_EMAIL, user);
return true;
}
}
Loading