-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Permission subset checks when creating roles (#64)
Expanded ability to check permissions for subset permissions; enforce role grants restrict to caller's permissions
- Loading branch information
1 parent
0fd141f
commit 6f97791
Showing
17 changed files
with
2,091 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 21 additions & 5 deletions
26
sor-api/src/main/java/com/bazaarvoice/emodb/sor/condition/Comparison.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,34 @@ | ||
package com.bazaarvoice.emodb.sor.condition; | ||
|
||
import com.bazaarvoice.emodb.sor.delta.Delta; | ||
|
||
public enum Comparison { | ||
GT("gt"), | ||
GE("ge"), | ||
LT("lt"), | ||
LE("le"); | ||
GT("gt", false), | ||
GE("ge", true), | ||
LT("lt", false), | ||
LE("le", true); | ||
|
||
private final String _deltaFunction; | ||
private final boolean _isClosed; | ||
|
||
private Comparison(String deltaFunction) { | ||
private Comparison(String deltaFunction, boolean isClosed) { | ||
_deltaFunction = deltaFunction; | ||
_isClosed = isClosed; | ||
} | ||
|
||
/** | ||
* Returns the name of the this comparison as it appears as a function in the delta syntax. | ||
* @see Delta#appendTo(Appendable) | ||
*/ | ||
public String getDeltaFunction() { | ||
return _deltaFunction; | ||
} | ||
|
||
/** | ||
* A comparison is closed if the associated value is included in the defined range. This method returns true for | ||
* GE and LE, false for GT and LT. | ||
*/ | ||
public boolean isClosed() { | ||
return _isClosed; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
sor-api/src/main/java/com/bazaarvoice/emodb/sor/condition/LikeCondition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,49 @@ | ||
package com.bazaarvoice.emodb.sor.condition; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
public interface LikeCondition extends Condition { | ||
|
||
/** | ||
* Returns the matching string used by this condition. | ||
*/ | ||
String getCondition(); | ||
|
||
/** | ||
* Returns true if the provided String is a match for this condition. | ||
*/ | ||
boolean matches(String input); | ||
|
||
/** | ||
* Returns true if there exists a value v which matches both this condition and the provided condition. | ||
* For example, like("a*") overlaps like("*c") since there exists a value, "abc", which matches both, | ||
* while like("a*") does not overlap like("b*") since they share no common values. | ||
*/ | ||
boolean overlaps(LikeCondition condition); | ||
|
||
/** | ||
* Returns true if for every value v which matches this condition v also matches the provided condition. | ||
* For example, like("ab*") is a subset of like("a*"), while like("a*") is not a subset of like("*c") since | ||
* there exists a value, "ab", which matches the former but not the latter. | ||
*/ | ||
boolean isSubsetOf(LikeCondition condition); | ||
|
||
/** | ||
* Returns the constant prefix shared by all results matching this condition, or null if no such prefix exists. | ||
* For example: "ab*cd" has prefix "ab" and "*cd" has prefix null. | ||
*/ | ||
@Nullable | ||
String getPrefix(); | ||
|
||
/** | ||
* Returns the constant suffix shared by all results matching this condition, or null if no such suffix exists. | ||
* For example: "ab*cd" has suffix "cd" and "ab*" has suffix null. | ||
*/ | ||
@Nullable | ||
String getSuffix(); | ||
|
||
/** | ||
* Returns true if the condition contains any wildcards, false if it is a constant. | ||
*/ | ||
boolean hasWildcards(); | ||
} |
Oops, something went wrong.