diff options
Diffstat (limited to 'server/sonar-web/src/main/js/apps/permissions')
-rw-r--r-- | server/sonar-web/src/main/js/apps/permissions/project/views/ApplyTemplateView.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/js/apps/permissions/project/views/ApplyTemplateView.js b/server/sonar-web/src/main/js/apps/permissions/project/views/ApplyTemplateView.js index a22e93f8740..487fb2c3822 100644 --- a/server/sonar-web/src/main/js/apps/permissions/project/views/ApplyTemplateView.js +++ b/server/sonar-web/src/main/js/apps/permissions/project/views/ApplyTemplateView.js @@ -33,7 +33,10 @@ export default ModalForm.extend({ }, loadPermissionTemplates () { - return getPermissionTemplates(this.options.project.organization).then(r => { + const request = this.options.organization ? + getPermissionTemplates(this.options.organization.key) : + getPermissionTemplates(); + return request.then(r => { this.permissionTemplates = r.permissionTemplates; this.render(); }); @@ -52,10 +55,14 @@ export default ModalForm.extend({ const permissionTemplate = this.$('#project-permissions-template').val(); this.disableForm(); - applyTemplateToProject({ + const data = { projectKey: this.options.project.key, templateId: permissionTemplate - }).then(() => { + }; + if (this.options.organization) { + data.organization = this.options.organization.key; + } + applyTemplateToProject(data).then(() => { this.trigger('done'); this.done = true; this.render(); |