diff --git a/lemur/auth/permissions.py b/lemur/auth/permissions.py index 7b311874..79950b36 100644 --- a/lemur/auth/permissions.py +++ b/lemur/auth/permissions.py @@ -23,9 +23,10 @@ CertificateOwnerNeed = partial(CertificateOwner, 'certificateView') class ViewKeyPermission(Permission): - def __init__(self, role_id, certificate_id): + def __init__(self, certificate_id, owner_id): c_need = CertificateCreatorNeed(str(certificate_id)) - o_need = CertificateOwnerNeed(str(role_id)) + o_need = CertificateOwnerNeed(str(owner_id)) + super(ViewKeyPermission, self).__init__(o_need, c_need, RoleNeed('admin')) diff --git a/lemur/roles/views.py b/lemur/roles/views.py index 85774eb1..e19e2e06 100644 --- a/lemur/roles/views.py +++ b/lemur/roles/views.py @@ -140,7 +140,7 @@ class RolesList(AuthenticatedResource): self.reqparse.add_argument('description', type=str, location='json') self.reqparse.add_argument('username', type=str, location='json') self.reqparse.add_argument('password', type=str, location='json') - self.reqparse.add_argument('users', type=dict, location='json') + self.reqparse.add_argument('users', type=list, location='json') args = self.reqparse.parse_args() return service.create(args['name'], args.get('password'), args.get('description'), args.get('username'), diff --git a/lemur/static/app/angular/roles/role/role.js b/lemur/static/app/angular/roles/role/role.js index 2e977637..bcffdf52 100644 --- a/lemur/static/app/angular/roles/role/role.js +++ b/lemur/static/app/angular/roles/role/role.js @@ -18,6 +18,12 @@ angular.module('lemur') $modalInstance.dismiss('cancel'); }; + $scope.userPage = 1; + $scope.loadMoreRoles = function () { + $scope.userPage += 1; + RoleService.loadMoreUsers($scope.role, $scope.userPage); + }; + $scope.userService = UserService; $scope.roleService = RoleService; }) diff --git a/lemur/static/app/angular/roles/role/role.tpl.html b/lemur/static/app/angular/roles/role/role.tpl.html index dc36bf19..12287ada 100644 --- a/lemur/static/app/angular/roles/role/role.tpl.html +++ b/lemur/static/app/angular/roles/role/role.tpl.html @@ -27,7 +27,7 @@ Username
- +
{{ role.username }} @@ -43,7 +43,7 @@ Password
- +

You must enter an password

@@ -61,7 +61,7 @@ + type="text" name="user" ng-model="role.selectedUser" placeholder="Username..." class="form-control"/> @@ -69,6 +69,10 @@ + + + +
{{ user.username }}
More
diff --git a/lemur/static/app/angular/roles/services.js b/lemur/static/app/angular/roles/services.js index 5b6d336b..af409b3e 100644 --- a/lemur/static/app/angular/roles/services.js +++ b/lemur/static/app/angular/roles/services.js @@ -34,11 +34,19 @@ angular.module('lemur') }; RoleService.getUsers = function (role) { - role.customGET('users').then(function (users) { + return role.getList('users').then(function (users) { role.users = users; }); }; + RoleService.loadMoreUsers = function (role, page) { + role.getList('users', {page: page}).then(function (users) { + _.each(users, function (user) { + role.users.push(user); + }); + }); + }; + RoleService.create = function (role) { return RoleApi.post(role).then( function () {