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

Commit

Permalink
Create the org manager check in the space page
Browse files Browse the repository at this point in the history
  • Loading branch information
rememberlenny committed Aug 24, 2017
1 parent 7bb36a0 commit 2c48b3a
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions static_src/components/users.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function stateSetter() {
let entityGuid;
const inviteDisabled = UserStore.inviteDisabled();
const usersSelectorDisabled = UserStore.usersSelectorDisabled();
const isOrgManager = UserStore.hasRole(currentUser.guid, currentOrgGuid,
const isOrgUserManager = UserStore.hasRole(currentUser.guid, currentOrgGuid,
ORG_MANAGER);

if (currentType === SPACE_NAME) {
Expand All @@ -55,19 +55,20 @@ function stateSetter() {
entityGuid = currentSpaceGuid;
currentUserAccess = UserStore.hasRole(currentUser.guid, currentSpaceGuid,
SPACE_MANAGER);
if (isOrgUserManager === true) {
currentUserAccess = true;
}
} else {
users = UserStore.getAllInOrg(currentOrgGuid);
entityGuid = currentOrgGuid;
currentUserAccess = UserStore.hasRole(currentUser.guid, currentOrgGuid,
ORG_MANAGER);
currentUserAccess = isOrgUserManager;
}

return {
currentUser,
error: UserStore.getError(),
inviteDisabled,
usersSelectorDisabled,
isOrgManager,
currentUserAccess,
currentOrgGuid,
currentSpaceGuid,
Expand Down Expand Up @@ -233,11 +234,16 @@ export default class Users extends React.Component {
get userParentEntityUserSelector() {
// only show something if in a space and if the user is a org manager
// or space manager.
if (!this.isSpace ||
(!this.currentUserIsSpaceManager && !this.currentUserIsOrgManager)) {
if (!this.isSpace) {
return null;
}

if (!this.currentUserIsOrgManager) {
if (!this.currentUserIsSpaceManager) {
return null;
}
}

return (
<UsersSelector
usersSelectorDisabled={ this.state.usersSelectorDisabled }
Expand Down

0 comments on commit 2c48b3a

Please sign in to comment.