|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.endeca.portal.data.security.DefaultMDEXSecurityManager
public class DefaultMDEXSecurityManager
This is a simple implementation of MDEXSecurityManager, providing role-based security filters via data source configuration. For a given data source, the following properties can be configured:
applySecurity(PortletRequest, MDEXState, Query)
method.
Field Summary | |
---|---|
static java.lang.String |
CONFIG_PROPERTY_INHERIT_SECURITY
JSON key for toggling security filter inheritance from parents on/off |
static java.lang.String |
CONFIG_PROPERTY_ROLE_PERMISSIONS
JSON key for defining available security roles for filters |
static java.lang.String |
CONFIG_PROPERTY_ROLE_PERMISSIONS_MULTI_OR
JSON key for specifying multiple filters from multiple roles should be logically OR-ed, default false=multi-roles ANDed |
static java.lang.String |
CONFIG_PROPERTY_SECURITY_ENABLED
JSON key for toggling security on/off |
static java.lang.String |
CONFIG_PROPERTY_SECURITY_FILTERS
JSON key for security filters |
protected boolean |
dirty
|
protected java.util.Map<java.lang.String,java.util.Set<QueryFunction>> |
mdexSecurityFilterMap
|
protected java.util.Set<com.liferay.portal.model.Role> |
userRoles
|
Constructor Summary | |
---|---|
DefaultMDEXSecurityManager()
Default constructor |
Method Summary | |
---|---|
protected void |
addFiltersFromRoles(java.lang.String mdexStateId,
org.json.JSONObject securityFilters,
org.json.JSONObject rolePermissions,
java.util.Set<QueryFunction> mdexQueryFilterSet,
boolean logicallyOrMultipleRoles,
MDEXState mdexState,
javax.portlet.PortletRequest request)
Calculates security filters for the user's Roles, and adds them to the Set of current filters. |
void |
applySecurity(javax.portlet.PortletRequest request,
MDEXState mdexState,
Query query)
See MDEXSecurityManager.applySecurity(PortletRequest, MDEXState, Query) |
protected java.util.Set<QueryFunction> |
createFilterSetFromJSON(org.json.JSONArray filterRefArray,
org.json.JSONObject securityFilters,
MDEXState mdexState,
javax.portlet.PortletRequest request)
Searches a set of JSON object representations of filters identified by name in the provided JSONArray. |
protected java.util.Set<com.liferay.portal.model.Role> |
getRolesForUser(java.lang.String remoteUser,
long companyId,
long currentGroupId)
Determines the set of roles and Liferay user groups to which the current user belongs. |
protected void |
init(javax.portlet.PortletRequest request)
Initializes an internal map of security filters associated with the user making the request, under any of the following conditions: This is the first time a request is made for the session. |
protected void |
initMDEXPermissions(MDEXState mdexState,
UserSession userSession,
javax.portlet.PortletRequest request)
Initializes a set of security filters for the provided MDEXState, which is then stored in this security manager's internal map of data source-to-filter mappings for the user. |
protected void |
initRoleBasedSecurityFilters(MDEXState mdexState,
UserSession userSession,
javax.portlet.PortletRequest request)
Gets a list of role-based security filters for a specified MDEXState. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected transient boolean dirty
public static final java.lang.String CONFIG_PROPERTY_SECURITY_ENABLED
public static final java.lang.String CONFIG_PROPERTY_ROLE_PERMISSIONS
public static final java.lang.String CONFIG_PROPERTY_ROLE_PERMISSIONS_MULTI_OR
public static final java.lang.String CONFIG_PROPERTY_SECURITY_FILTERS
public static final java.lang.String CONFIG_PROPERTY_INHERIT_SECURITY
protected java.util.Map<java.lang.String,java.util.Set<QueryFunction>> mdexSecurityFilterMap
protected transient java.util.Set<com.liferay.portal.model.Role> userRoles
Constructor Detail |
---|
public DefaultMDEXSecurityManager()
Method Detail |
---|
public void applySecurity(javax.portlet.PortletRequest request, MDEXState mdexState, Query query) throws MDEXSecurityException
MDEXSecurityManager.applySecurity(PortletRequest, MDEXState, Query)
applySecurity
in interface MDEXSecurityManager
request
- the PortletRequestmdexState
- the MDEXState object representing the target
MDEX and its current statequery
- the Query to which security filters should be applied
MDEXSecurityException
- on error parsing, processing, or applying securityQuery
protected void init(javax.portlet.PortletRequest request) throws MDEXSecurityException
#initMDEXPermissions(MDEXState, UserSession)
method is called.
request
- the PortletRequest
MDEXSecurityException
protected java.util.Set<com.liferay.portal.model.Role> getRolesForUser(java.lang.String remoteUser, long companyId, long currentGroupId) throws java.lang.NumberFormatException, com.liferay.portal.PortalException, com.liferay.portal.SystemException
remoteUser
- String representing the id of the current user, or null if the user is unauthenticated.
This param should be generated by PortletRequest.getRemoteUser().companyId
- the Liferay company id for the current request
java.lang.NumberFormatException
com.liferay.portal.PortalException
com.liferay.portal.SystemException
protected void initMDEXPermissions(MDEXState mdexState, UserSession userSession, javax.portlet.PortletRequest request) throws MDEXSecurityException
mdexState
- the MDEXStateuserSession
- the UserSession instance for this session
MDEXSecurityException
protected void initRoleBasedSecurityFilters(MDEXState mdexState, UserSession userSession, javax.portlet.PortletRequest request) throws MDEXSecurityException
mdexState
- the MDEXStateuserSession
- the UserSession instance for this session
MDEXSecurityException
protected void addFiltersFromRoles(java.lang.String mdexStateId, org.json.JSONObject securityFilters, org.json.JSONObject rolePermissions, java.util.Set<QueryFunction> mdexQueryFilterSet, boolean logicallyOrMultipleRoles, MDEXState mdexState, javax.portlet.PortletRequest request) throws MDEXSecurityException
Set
of current filters. The
set passed in may already contain filters from a parent data source, if inheritSecurity is enabled. Inherited parent security
filters are always ANDed with filters from the child data source.
By default, the following logic applies in the case of multiple security filters:
mdexStateId
- securityFilters
- rolePermissions
- mdexQueryFilterSet
- logicallyOrMultipleRoles
-
MDEXSecurityException
protected java.util.Set<QueryFunction> createFilterSetFromJSON(org.json.JSONArray filterRefArray, org.json.JSONObject securityFilters, MDEXState mdexState, javax.portlet.PortletRequest request) throws org.json.JSONException, MDEXSecurityException
JSONArray of names:
["filter1","filter2"]
List of security filters:
{
"filter1": {
"class":"com.endeca.portal.data.functions.DataSourceFilter",
"filterString":"Region='Bordeaux' or Region='Burgundy'"
},
"filter2": {
"class":"com.endeca.portal.data.functions.DataSourceFilter",
"filterString":"Region='Sonoma'"
}
}
filterRefArray
- a JSON Array of filter names to look forsecurityFilters
- a JSON Object storing a list of filters
org.json.JSONException
MDEXSecurityException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |