-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Per-entity CRUD filters for update/delete operations #502
.. renaming create/update/delete filters to "authorizers". The new name is more appropriate as they fail entire requests, not just exclude disallowed operations .. moving from "filter" to "access" package
- Loading branch information
Showing
37 changed files
with
212 additions
and
211 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
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
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
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
29 changes: 29 additions & 0 deletions
29
agrest-engine/src/main/java/io/agrest/access/AllowAllCreateAuthorizer.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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package io.agrest.access; | ||
|
||
import io.agrest.EntityUpdate; | ||
|
||
/** | ||
* @since 4.8 | ||
*/ | ||
final class AllowAllCreateAuthorizer<T> implements CreateAuthorizer<T> { | ||
|
||
static final AllowAllCreateAuthorizer instance = new AllowAllCreateAuthorizer(); | ||
|
||
private AllowAllCreateAuthorizer() { | ||
} | ||
|
||
@Override | ||
public boolean isAllowed(EntityUpdate<T> update) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean allowsAll() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public CreateAuthorizer<T> andThen(CreateAuthorizer<T> another) { | ||
return another; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
agrest-engine/src/main/java/io/agrest/access/AllowAllDeleteAuthorizer.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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package io.agrest.access; | ||
|
||
/** | ||
* @since 4.8 | ||
*/ | ||
final class AllowAllDeleteAuthorizer<T> implements DeleteAuthorizer<T> { | ||
|
||
static final AllowAllDeleteAuthorizer instance = new AllowAllDeleteAuthorizer(); | ||
|
||
private AllowAllDeleteAuthorizer() { | ||
} | ||
|
||
@Override | ||
public boolean isAllowed(T object) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean allowsAll() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public DeleteAuthorizer<T> andThen(DeleteAuthorizer<T> another) { | ||
return another; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
.../io/agrest/filter/AllowAllReadFilter.java → .../io/agrest/access/AllowAllReadFilter.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,4 +1,4 @@ | ||
package io.agrest.filter; | ||
package io.agrest.access; | ||
|
||
/** | ||
* @since 4.8 | ||
|
29 changes: 29 additions & 0 deletions
29
agrest-engine/src/main/java/io/agrest/access/AllowAllUpdateAuthorizer.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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package io.agrest.access; | ||
|
||
import io.agrest.EntityUpdate; | ||
|
||
/** | ||
* @since 4.8 | ||
*/ | ||
final class AllowAllUpdateAuthorizer<T> implements UpdateAuthorizer<T> { | ||
|
||
static final AllowAllUpdateAuthorizer instance = new AllowAllUpdateAuthorizer(); | ||
|
||
private AllowAllUpdateAuthorizer() { | ||
} | ||
|
||
@Override | ||
public boolean isAllowed(T object, EntityUpdate<T> update) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean allowsAll() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public UpdateAuthorizer<T> andThen(UpdateAuthorizer<T> another) { | ||
return another; | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
...java/io/agrest/filter/PropertyFilter.java → ...java/io/agrest/access/PropertyFilter.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,4 +1,4 @@ | ||
package io.agrest.filter; | ||
package io.agrest.access; | ||
|
||
import java.util.Objects; | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...filter/PropertyFilteringRulesBuilder.java → ...access/PropertyFilteringRulesBuilder.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
2 changes: 1 addition & 1 deletion
2
...ain/java/io/agrest/filter/ReadFilter.java → ...ain/java/io/agrest/access/ReadFilter.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
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
2 changes: 1 addition & 1 deletion
2
agrest-engine/src/main/java/io/agrest/constraints/ConstrainedAgEntity.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
2 changes: 1 addition & 1 deletion
2
agrest-engine/src/main/java/io/agrest/constraints/Constraint.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
2 changes: 1 addition & 1 deletion
2
agrest-engine/src/main/java/io/agrest/constraints/ConstraintsBuilder.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
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
2 changes: 1 addition & 1 deletion
2
agrest-engine/src/main/java/io/agrest/encoder/EncoderEntityCondition.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
2 changes: 1 addition & 1 deletion
2
agrest-engine/src/main/java/io/agrest/encoder/EncoderMethod.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
2 changes: 1 addition & 1 deletion
2
agrest-engine/src/main/java/io/agrest/encoder/EncoderObjectCondition.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
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
2 changes: 1 addition & 1 deletion
2
agrest-engine/src/main/java/io/agrest/encoder/EntityEncoderFilterBuilder.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
2 changes: 1 addition & 1 deletion
2
agrest-engine/src/main/java/io/agrest/encoder/FilterChainEncoder.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
Oops, something went wrong.