mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Fix duplicate scope publishing issue
This commit is contained in:
commit
5851202d32
@ -456,17 +456,19 @@ public class APIPublisherServiceImpl implements APIPublisherService {
|
|||||||
|
|
||||||
Scope scope = new Scope();
|
Scope scope = new Scope();
|
||||||
for (DefaultPermission defaultPermission: defaultPermissions.getDefaultPermissions()) {
|
for (DefaultPermission defaultPermission: defaultPermissions.getDefaultPermissions()) {
|
||||||
//todo check whether scope is available or not
|
if (!publisherRESTAPIServices.isSharedScopeNameExists(apiApplicationKey, accessTokenInfo,
|
||||||
ScopeMapping scopeMapping = defaultPermission.getScopeMapping();
|
defaultPermission.getScopeMapping().getKey())) {
|
||||||
|
ScopeMapping scopeMapping = defaultPermission.getScopeMapping();
|
||||||
|
|
||||||
List<String> bindings = new ArrayList<>(
|
List<String> bindings = new ArrayList<>(
|
||||||
Arrays.asList(scopeMapping.getDefaultRoles().split(",")));
|
Arrays.asList(scopeMapping.getDefaultRoles().split(",")));
|
||||||
bindings.add(ADMIN_ROLE_KEY);
|
bindings.add(ADMIN_ROLE_KEY);
|
||||||
scope.setName(scopeMapping.getKey());
|
scope.setName(scopeMapping.getKey());
|
||||||
scope.setDescription(scopeMapping.getName());
|
scope.setDescription(scopeMapping.getName());
|
||||||
scope.setDisplayName(scopeMapping.getName());
|
scope.setDisplayName(scopeMapping.getName());
|
||||||
scope.setBindings(bindings);
|
scope.setBindings(bindings);
|
||||||
publisherRESTAPIServices.addNewSharedScope(apiApplicationKey, accessTokenInfo, scope);
|
publisherRESTAPIServices.addNewSharedScope(apiApplicationKey, accessTokenInfo, scope);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (BadRequestException | UnexpectedResponseException | APIServicesException e) {
|
} catch (BadRequestException | UnexpectedResponseException | APIServicesException e) {
|
||||||
log.error("Error occurred while adding default scopes");
|
log.error("Error occurred while adding default scopes");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user