Skip to content
This repository has been archived by the owner on Oct 20, 2021. It is now read-only.

feat(api): Context-path can be changed by primary_owner or administra… #204

Merged
merged 1 commit into from Sep 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/app/api/admin/general/apiGeneral.controller.js
Expand Up @@ -14,10 +14,11 @@
* limitations under the License.
*/
class ApiAdminController {
constructor(ApiService, NotificationService, $scope, $mdDialog, $mdEditDialog, $rootScope, resolvedApi, base64, $state) {
constructor(ApiService, NotificationService, UserService, $scope, $mdDialog, $mdEditDialog, $rootScope, resolvedApi, base64, $state) {
'ngInject';
this.ApiService = ApiService;
this.NotificationService = NotificationService;
this.UserService = UserService;
this.$scope = $scope;
this.$rootScope = $rootScope;
this.$mdEditDialog = $mdEditDialog;
Expand Down Expand Up @@ -80,6 +81,9 @@ class ApiAdminController {
}
}

// Context-path editable
this.contextPathEditable = (this.api.permission === 'primary_owner') || this.UserService.isUserInRoles(['ADMIN']);

var self = this;
this.$scope.$on("apiChangeSucceed", function () {
self.initialApi = _.cloneDeep(self.$scope.$parent.apiCtrl.api);
Expand Down
4 changes: 3 additions & 1 deletion src/app/api/admin/general/apiGeneral.html
Expand Up @@ -96,7 +96,9 @@
<div layout-gt-sm="row">
<md-input-container class="md-block" flex-gt-sm>
<label>Gateway context path *</label>
<input ng-model="generalCtrl.api.proxy.context_path" type="text" ng-pattern="/^\/[\/.a-zA-Z0-9-]+$/" required>
<input ng-model="generalCtrl.api.proxy.context_path" type="text"
ng-pattern="/^\/[\/.a-zA-Z0-9-]+$/" ng-disabled="!generalCtrl.contextPathEditable"
required>
</md-input-container>
</div>

Expand Down
Expand Up @@ -79,6 +79,12 @@ function DialogApiPermissionsHelpController($scope, $mdDialog) {
"user": false,
"owner": true,
"primary_owner": true
},{
"action": "Change context-path",
"anyone": false,
"user": false,
"owner": false,
"primary_owner": true
},
{
"action": "Delete API",
Expand Down