public abstract class BaseSession extends Object implements Session
Modifier and Type | Field and Description |
---|---|
protected Directory |
directory |
protected static String |
MULTI_TENANT_ID_FORMAT |
protected PermissionDescriptor[] |
permissions |
protected static String |
POWER_USERS_GROUP |
protected static String |
READONLY_ENTRY_FLAG |
Modifier | Constructor and Description |
---|---|
protected |
BaseSession(Directory directory) |
Modifier and Type | Method and Description |
---|---|
void |
checkDeleteConstraints(String entryId)
Checks that there are no constraints for deleting the given entry id.
|
void |
checkPermission(String permission)
Checks the current user rights for the given permission against the read-only flag and the permission descriptor.
|
static String |
computeMultiTenantDirectoryId(String tenantId,
String id)
Compute a multi tenant directory id based on the given
tenantId . |
static DocumentModel |
createEntryModel(String sessionId,
String schema,
String id,
Map<String,Object> values)
Returns a bare document model suitable for directory implementations.
|
static DocumentModel |
createEntryModel(String sessionId,
String schema,
String id,
Map<String,Object> values,
boolean readOnly)
Returns a bare document model suitable for directory implementations.
|
abstract Directory |
getDirectory()
To be implemented with a more specific return type.
|
String |
getIdField()
The Id field is the name of the field that is used a primary key: unique and not null value in the whole
directory.
|
String |
getPasswordField() |
boolean |
hasPermission(String permission)
Checks the current user rights for the given permission against the read-only flag and the permission descriptor.
|
protected boolean |
hasPermission(String permission,
String username,
List<String> groups) |
boolean |
isAuthenticating()
Tells whether the directory implementation can be used as an authenticating backend for the UserManager (based on
login / password check).
|
boolean |
isReadOnly() |
static boolean |
isReadOnlyEntry(DocumentModel entry)
Test whether entry comes from a read-only back-end directory.
|
protected static Map<String,Object> |
mkObjectMap(Map<String,Serializable> map) |
protected static Map<String,Serializable> |
mkSerializableMap(Map<String,Object> map) |
DocumentModelList |
query(Map<String,Serializable> filter,
Set<String> fulltext,
Map<String,String> orderBy,
boolean fetchReferences,
int limit,
int offset)
Executes a query with the possibility to fetch a subset of the results.
|
static void |
setReadOnlyEntry(DocumentModel entry)
Set the read-only flag of a directory entry.
|
static void |
setReadWriteEntry(DocumentModel entry)
Unset the read-only flag of a directory entry.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
authenticate, close, createEntry, createEntry, deleteEntry, deleteEntry, deleteEntry, getEntries, getEntry, getEntry, getProjection, getProjection, hasEntry, query, query, query, query, updateEntry
protected static final String POWER_USERS_GROUP
protected static final String READONLY_ENTRY_FLAG
protected static final String MULTI_TENANT_ID_FORMAT
protected PermissionDescriptor[] permissions
protected BaseSession(Directory directory)
public abstract Directory getDirectory()
public String getIdField()
Session
getIdField
in interface Session
public String getPasswordField()
getPasswordField
in interface Session
public boolean isAuthenticating()
Session
isAuthenticating
in interface Session
public boolean isReadOnly()
isReadOnly
in interface Session
public void checkPermission(String permission)
Throws DirectorySecurityException
if the user does not have adequate privileges.
DirectorySecurityException
- if access is deniedpublic void checkDeleteConstraints(String entryId)
public boolean hasPermission(String permission)
Returns false
if the user does not have adequate privileges.
false
if access is deniedprotected boolean hasPermission(String permission, String username, List<String> groups)
public static DocumentModel createEntryModel(String sessionId, String schema, String id, Map<String,Object> values) throws PropertyException
Can be used for creation screen.
PropertyException
public static DocumentModel createEntryModel(String sessionId, String schema, String id, Map<String,Object> values, boolean readOnly) throws PropertyException
Allow setting the readonly entry flag to Boolean.TRUE
. See Session#isReadOnlyEntry(DocumentModel)
PropertyException
protected static Map<String,Serializable> mkSerializableMap(Map<String,Object> map)
protected static Map<String,Object> mkObjectMap(Map<String,Serializable> map)
public static boolean isReadOnlyEntry(DocumentModel entry)
public static void setReadOnlyEntry(DocumentModel entry)
public static void setReadWriteEntry(DocumentModel entry)
public static String computeMultiTenantDirectoryId(String tenantId, String id)
tenantId
.public DocumentModelList query(Map<String,Serializable> filter, Set<String> fulltext, Map<String,String> orderBy, boolean fetchReferences, int limit, int offset) throws DirectoryException
Session
query
in interface Session
limit
- maximum number of results ignored if less than 1offset
- number of rows skipped before starting, will be 0 if less than 0.DirectoryException
Session.query(Map, Set, Map, boolean)
Copyright © 2016 Nuxeo SA. All rights reserved.