boolean hasResourceGroupView = authorizationManager.canViewGroup(subject, resourceGroupId);
if (!hasResourceGroupView) {
String msg = "Subject [" + subject.getName() + "] requires VIEW permission on resource group ["
+ resourceGroupId + "].";
throw new PermissionException(msg);
}
Set<Permission> globalPerms = authorizationManager.getExplicitGlobalPermissions(subject);
boolean hasGlobalDeployBundles = globalPerms.contains(Permission.DEPLOY_BUNDLES);
boolean hasGlobalViewBundles = globalPerms.contains(Permission.VIEW_BUNDLES);
if (hasGlobalDeployBundles && hasGlobalViewBundles) {
return;
}
boolean hasResourceGroupDeploy = hasGlobalDeployBundles
|| authorizationManager.hasGroupPermission(subject, Permission.DEPLOY_BUNDLES_TO_GROUP, resourceGroupId);
boolean hasBundleView = hasGlobalViewBundles || authorizationManager.canViewBundle(subject, bundleId);
if (!(hasResourceGroupDeploy && hasBundleView)) {
String msg = "Subject [" + subject.getName()
+ "] requires DEPLOY permission (global or on for resource group [" + resourceGroupId
+ "] and VIEW permission for bundle [" + bundleId + "]";
throw new PermissionException(msg);
}
}