Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1202 from 18F/lkb-roles-as-orgman
Browse files Browse the repository at this point in the history
Add user check org org manager
  • Loading branch information
jcscottiii authored Aug 25, 2017
2 parents fcfe7d9 + 2e30185 commit 3ade394
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
10 changes: 7 additions & 3 deletions static_src/components/users.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ function stateSetter() {
let users = [];
let parentEntityUsers;
let currentUserAccess = false;
let entityGuid;
const inviteDisabled = UserStore.inviteDisabled();
const usersSelectorDisabled = UserStore.usersSelectorDisabled();
let entityGuid;
const isOrgUserManager = UserStore.hasRole(currentUser.guid, currentOrgGuid,
ORG_MANAGER);

if (currentType === SPACE_NAME) {
users = UserStore.getAllInSpace(currentSpaceGuid);
Expand All @@ -56,8 +58,10 @@ function stateSetter() {
} else {
users = UserStore.getAllInOrg(currentOrgGuid);
entityGuid = currentOrgGuid;
currentUserAccess = UserStore.hasRole(currentUser.guid, currentOrgGuid,
ORG_MANAGER);
}

if (isOrgUserManager === true) {
currentUserAccess = true;
}

return {
Expand Down
23 changes: 23 additions & 0 deletions static_src/test/functional/user_role.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,29 @@ describe('User roles', function () {
expect(userRoleElement.isUserSpaceDeveloper(guidManagerOrgXSpaceYY)).toBe(true);
});
});

describe('As org manager X', function () {
beforeEach(function () {
// sets cookie to org Y manager
cookieValue = cookieManagerOrgX;
});

describe('should have permission to edit fields on space Y pages', function () {
it('should set url to org X space XX', function () {
browser.url(urlOrgXSpaceXX);
});

it('verifies that the current user is a user with only permissions to org X', function () {
cookieResult = userRoleElement.setAndGetUserRole(cookieValue);
expect(cookieResult).toBe(cookieManagerOrgX);
});

it('verify org X manager can modify space XX page', function () {
browser.waitForExist('.test-user-role-control');
expect(userRoleElement.isFirstUserRoleEnabled()).toBe(true);
});
});
});
});

describe('Testing space user roles', function () {
Expand Down

0 comments on commit 3ade394

Please sign in to comment.