U - Type of AppUserT - Type of hosting tableR - Type of remote tablepublic class RemoteAccessRoleProvider<U extends AppUser,T extends DataObject,R extends DataObject> extends java.lang.Object implements AccessRoleProvider<U,T>
DataObjectFactory that forwards role relationships from a remote object
The AppUser has the role with the target object if the user has the same named role with
the remote object the target references.| Constructor and Description |
|---|
RemoteAccessRoleProvider(SessionService<U> sess,
DataObjectFactory<T> home_fac,
java.lang.String link_field) |
| Modifier and Type | Method and Description |
|---|---|
void |
addRelationships(java.util.Set<java.lang.String> roles)
Add known roles to a set.
|
BaseFilter<T> |
hasRelationFilter(java.lang.String role,
U user)
Get a
BaseFilter corresponding to target objects where the given user has
the specified relation. |
BaseFilter<U> |
personInRelationFilter(SessionService<U> sess,
java.lang.String role,
T target)
Get a
BaseFilter for AppUsers that are in the specified relationship with
the target object. |
boolean |
providesRelationship(java.lang.String role)
Does this class provide the named relationship.
|
public RemoteAccessRoleProvider(SessionService<U> sess, DataObjectFactory<T> home_fac, java.lang.String link_field) throws UnknownRelationshipException
UnknownRelationshipExceptionpublic BaseFilter<T> hasRelationFilter(java.lang.String role, U user)
AccessRoleProviderBaseFilter corresponding to target objects where the given user has
the specified relation.
If the method returns null then the role is not recognised by the provider.
A non-null result means the role is recognised but does not imply
that any target will match. The relation with a specific target object can be tested using
DataObjectFactory.matches(BaseFilter, DataObject)
This method should not be called directly only via a call to SessionService.getRelationshipRoleFilter(DataObjectFactory, String)
to allow the SessionService to combine and customise access rules.hasRelationFilter in interface AccessRoleProvider<U extends AppUser,T extends DataObject>BaseFilter or nullpublic BaseFilter<U> personInRelationFilter(SessionService<U> sess, java.lang.String role, T target)
AccessRoleProviderBaseFilter for AppUsers that are in the specified relationship with
the target object.
This is the inverse of #hasRelationFilter(SessionService, String) used to generate a list
of AppUser with the relation. It can always be implemented (inefficiently) by creating an AcceptFilter
that uses AccessRoleProvider.hasRelationFilter(String, AppUser) to check each person in turn but though it is usually possible to find some SQLFilter
to narrow the selection first even if a full SQL implementation is not possible.
If the target is null it should generate a filter for any user in relation with targets
selected by DataObjectFactory.getDefaultRelationshipFilter(). If this is not possible
it should return null;personInRelationFilter in interface AccessRoleProvider<U extends AppUser,T extends DataObject>BaseFilter or nullpublic boolean providesRelationship(java.lang.String role)
AccessRoleProviderprovidesRelationship in interface AccessRoleProvider<U extends AppUser,T extends DataObject>public void addRelationships(java.util.Set<java.lang.String> roles)
AccessRoleProvideraddRelationships in interface AccessRoleProvider<U extends AppUser,T extends DataObject>