Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

added OwnershipPermissionCheck #1089

Merged
merged 1 commit into from Jun 27, 2022

Conversation

violetd12
Copy link
Contributor

@violetd12 violetd12 commented Jun 23, 2022

No description provided.

@coveralls
Copy link

coveralls commented Jun 23, 2022

Coverage Status

Coverage increased (+0.1%) to 77.173% when pulling f6fc1e6 on violet/cism-3873_OwnershipPermissionCheck into 3e167e0 on master.

public boolean isAllowed(Object source, String action, Object target) {
boolean hasPermission = false;

if (isClient(source) && isSecret(target)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome, super readable.


if (isClient(source) && isSecret(target)) {
Set<Group> clientGroups = aclDAO.getGroupsFor((Client) source);
String secretOwner =((Secret) target).getOwner();
Copy link
Contributor

Choose a reason for hiding this comment

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

We should really get Checkstyle going for this project, but in the meantime make sure you always put a space on both sides of an equal sign.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there is. just realized that the style guide warned me about the if statement simplification for the help functions. but not the spacing

public void testIsAllowedWhenSourceIsNotAClient() {
boolean permitted = ownershipPermissionCheck.isAllowed(USER, Action.CREATE, SECRET_WITH_OWNER);

assertThat(permitted).isEqualTo(false);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had to make this explicitly equal to false because it appears that assertThat(permitted) always returns true

@violetd12 violetd12 force-pushed the violet/cism-3873_OwnershipPermissionCheck branch from 35fa9ae to f6fc1e6 Compare June 27, 2022 17:32
@violetd12 violetd12 merged commit 41bc4d4 into master Jun 27, 2022
@violetd12 violetd12 deleted the violet/cism-3873_OwnershipPermissionCheck branch June 27, 2022 17:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants