Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into boot2
Browse files Browse the repository at this point in the history
  • Loading branch information
cfieber committed Apr 22, 2019
2 parents bdbae49 + 4651b4b commit cfa2357
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ private boolean permissionContains(UserPermission.View permission,
.stream()
.anyMatch(view -> view.getName().equalsIgnoreCase(resourceName));
case BUILD_SERVICE:
return containsAuth.apply(permission.getBuildServices());
return permission.isLegacyFallback() || containsAuth.apply(permission.getBuildServices());
default:
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

public enum Authorization {
READ,
WRITE;
WRITE,
EXECUTE;

public static Set<Authorization> ALL = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(values())));
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ public Set<Authorization> getAuthorizations(List<String> userRoles) {
.collect(Collectors.toSet());
}

//VisibleForTesting
protected List<String> get(Authorization a) {
public List<String> get(Authorization a) {
return permissions.get(a);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class PermissionsSpec extends Specification {

private static final Authorization R = Authorization.READ
private static final Authorization W = Authorization.WRITE
private static final Authorization E = Authorization.EXECUTE

@Autowired
TestConfigProps testConfigProps
Expand Down Expand Up @@ -152,7 +153,7 @@ class PermissionsSpec extends Specification {
Permissions p = new Permissions.Builder().build()

expect:
p.getAuthorizations([]) == [R, W] as Set
p.getAuthorizations([]) == [R, W, E] as Set

when:
p = Permissions.factory([(R): ["bar"], (W): ["bar"]])
Expand Down

0 comments on commit cfa2357

Please sign in to comment.