|
34 | 34 | import javax.inject.Inject; |
35 | 35 | import javax.naming.ConfigurationException; |
36 | 36 |
|
| 37 | +import com.cloud.user.*; |
37 | 38 | import org.apache.cloudstack.acl.SecurityChecker.AccessType; |
38 | 39 | import org.apache.cloudstack.api.ApiConstants; |
39 | 40 | import org.apache.cloudstack.api.BaseCmd; |
|
184 | 185 | import com.cloud.storage.dao.VolumeDao; |
185 | 186 | import com.cloud.template.TemplateAdapter.TemplateAdapterType; |
186 | 187 | import com.cloud.template.VirtualMachineTemplate.BootloaderType; |
187 | | -import com.cloud.user.Account; |
188 | | -import com.cloud.user.AccountManager; |
189 | | -import com.cloud.user.AccountService; |
190 | | -import com.cloud.user.AccountVO; |
191 | | -import com.cloud.user.ResourceLimitService; |
192 | | -import com.cloud.user.UserData; |
193 | 188 | import com.cloud.user.dao.AccountDao; |
194 | 189 | import com.cloud.uservm.UserVm; |
195 | 190 | import com.cloud.utils.DateUtil; |
@@ -1448,6 +1443,7 @@ public boolean updateTemplateOrIsoPermissions(BaseUpdateTemplateOrIsoPermissions |
1448 | 1443 | // Input validation |
1449 | 1444 | final Long id = cmd.getId(); |
1450 | 1445 | final Account caller = CallContext.current().getCallingAccount(); |
| 1446 | + final User user = CallContext.current().getCallingUser(); |
1451 | 1447 | List<String> accountNames = cmd.getAccountNames(); |
1452 | 1448 | List<Long> projectIds = cmd.getProjectIds(); |
1453 | 1449 | Boolean isFeatured = cmd.isFeatured(); |
@@ -1517,9 +1513,9 @@ public boolean updateTemplateOrIsoPermissions(BaseUpdateTemplateOrIsoPermissions |
1517 | 1513 | } |
1518 | 1514 |
|
1519 | 1515 | if (owner.getType() == Account.Type.PROJECT) { |
1520 | | - // Currently project owned templates cannot be shared outside project but is available to all users within project by default. |
1521 | | - throw new InvalidParameterValueException("Update template permissions is an invalid operation on template " + template.getName() + |
1522 | | - ". Project owned templates cannot be shared outside template."); |
| 1516 | + _accountMgr.checkAccess(user, template); |
| 1517 | +// throw new InvalidParameterValueException("Update template permissions is an invalid operation on template " + template.getName() + |
| 1518 | +// ". Project owned templates cannot be shared outside the project."); |
1523 | 1519 | } |
1524 | 1520 |
|
1525 | 1521 | // check configuration parameter(allow.public.user.templates) value for |
|
0 commit comments