Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HSC-1209: Remove UX when user does not have the correct permissions #1 #849

Merged
merged 6 commits into from
Nov 17, 2016

Conversation

richard-cox
Copy link
Contributor

Remove features when user has no permissions to execute. This improves the experience for non-admins where previously options were provided to them that could never be enabled.

Covers endpoints side of console. Applications side to come

that.clusterActions = [];

if (canCreateOrg || isAdmin) {
that.clusterActions.push(createOrg);
Copy link
Contributor

@irfanhabib irfanhabib Nov 16, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

authModel.isAllowed(that.clusterGuid, authModel.resources.organization, authModel.actions.create); whill check if the user is an admin or not. Therefore the || isAdmin check is redundant.

}
if (canCreateSpace || isAdmin) {
that.clusterActions.push(createSpace);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

}
if (canAssignUsers || isAdmin) {
that.clusterActions.push(assignUsers);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to keep this one, there's a path that doesn't go through authModel.isAllowed and instead uses org/space manager count

function init() {
this.showManageRoles = function () {
return that.canUserManageRoles() || that.isAdmin;
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

canUserManageRoles takes care of the isAdmin check via the authModel.

that.userActions[0].disabled = !that.canUserManageRoles();
this.showRemoveFromSpace = function () {
return that.canUserRemoveFromSpace() || that.isAdmin;
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here


this.showRemoveFromOrg = function () {
return that.canUserRemoveFromOrg() || that.isAdmin;
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

@@ -23,7 +23,7 @@
<dd>{{ orgSummaryTileCtrl.getEndpoint() }}</dd>
<dt translate>CF Interactions</dt>
<dd>
<a ng-click="orgSummaryTileCtrl.cliCommands.show(orgSummaryTileCtrl.getEndpoint(), orgSummaryTileCtrl.userName, orgSummaryTileCtrl.organization.details.org.entity.name)"
<a ng-click="orgSummaryTileCtrl.cliCommands.show(orgSummaryTileCtrl.getEndpoint(), orgSummaryTileCtrl.userName, orgSummaryTileCtrl.clusterGuid, orgSummaryTileCtrl.organization)"
class="btn btn-link" translate>CLI Commands</a>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For improved readability, could we refactor this to a method on the controller like orgSummaryTileCtrl.showCliCommands()

@irfanhabib
Copy link
Contributor

LGTM, there are some redundant conditions which should never be hit, therefore can be removed.

@irfanhabib
Copy link
Contributor

LGTM

@irfanhabib irfanhabib merged commit de460be into master Nov 17, 2016
@irfanhabib irfanhabib deleted the 1209-remove-ui-when-no-permissions branch November 17, 2016 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants