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

Add user check org org manager #1202

Merged
merged 4 commits into from
Aug 25, 2017
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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