remove Project Template Permissions inhibition (#9196)

This commit is contained in:
dahn 2024-06-21 11:50:49 +02:00 committed by GitHub
parent 083ac069ca
commit 60f234c682
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View File

@ -189,6 +189,7 @@ import com.cloud.user.AccountManager;
import com.cloud.user.AccountService;
import com.cloud.user.AccountVO;
import com.cloud.user.ResourceLimitService;
import com.cloud.user.User;
import com.cloud.user.UserData;
import com.cloud.user.dao.AccountDao;
import com.cloud.uservm.UserVm;
@ -1448,6 +1449,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
// Input validation
final Long id = cmd.getId();
final Account caller = CallContext.current().getCallingAccount();
final User user = CallContext.current().getCallingUser();
List<String> accountNames = cmd.getAccountNames();
List<Long> projectIds = cmd.getProjectIds();
Boolean isFeatured = cmd.isFeatured();
@ -1517,9 +1519,8 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
}
if (owner.getType() == Account.Type.PROJECT) {
// Currently project owned templates cannot be shared outside project but is available to all users within project by default.
throw new InvalidParameterValueException("Update template permissions is an invalid operation on template " + template.getName() +
". Project owned templates cannot be shared outside template.");
// if it is a project owned template/iso, the user must at least have access to be allowed to share it.
_accountMgr.checkAccess(user, template);
}
// check configuration parameter(allow.public.user.templates) value for

View File

@ -2276,6 +2276,7 @@ export default {
}
args.zoneid = _.get(this.zone, 'id')
args.templatefilter = templateFilter
args.projectid = -1
args.details = 'all'
args.showicon = 'true'
args.id = this.templateId
@ -2298,6 +2299,7 @@ export default {
}
args.zoneid = _.get(this.zone, 'id')
args.isoFilter = isoFilter
args.projectid = -1
args.bootable = true
args.showicon = 'true'
args.id = this.isoId