本文整理汇总了Java中com.liferay.portal.security.permission.PermissionThreadLocal.getPermissionChecker方法的典型用法代码示例。如果您正苦于以下问题:Java PermissionThreadLocal.getPermissionChecker方法的具体用法?Java PermissionThreadLocal.getPermissionChecker怎么用?Java PermissionThreadLocal.getPermissionChecker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.security.permission.PermissionThreadLocal
的用法示例。
在下文中一共展示了PermissionThreadLocal.getPermissionChecker方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: _getPermissionChecker
import com.liferay.portal.security.permission.PermissionThreadLocal; //导入方法依赖的package包/类
private static PermissionChecker _getPermissionChecker() throws PrincipalException {
PermissionChecker permissionChecker =
PermissionThreadLocal.getPermissionChecker();
if (permissionChecker == null) {
throw new PrincipalException("PermissionChecker not initialized");
}
return permissionChecker;
}
示例2: _setCustomAttribute
import com.liferay.portal.security.permission.PermissionThreadLocal; //导入方法依赖的package包/类
/**
* Setting dei custom attribute dell'utente
*
* @param user user
* @param request request
*/
private void _setCustomAttribute(User user, HttpServletRequest request) {
if (_log.isDebugEnabled())
_log.debug("[START] Setto i Custom Attribute.");
String _pec = request.getHeader(ShibbolethPropsValues.SHIBBOLETH_DIGITAL_ADDRESS);
String _fiscalcode = request.getHeader(ShibbolethPropsValues.SHIBBOLETH_FISCAL_NUMBER);
_fiscalcode = _fiscalcode.toUpperCase();
//
String _birthplace = request.getHeader(ShibbolethPropsValues.SHIBBOLETH_PLACE_OF_BIRTH);
String _birthplace_stato = request.getHeader(ShibbolethPropsValues.SHIBBOLETH_COUNTY_OF_BIRTH);
//
String _telephonenumber = request.getHeader(ShibbolethPropsValues.SHIBBOLETH_HOME_PHONE);
String _cellularnumber = request.getHeader(ShibbolethPropsValues.SHIBBOLETH_MOBILE_PHONE);
String _validate = request.getHeader(ShibbolethPropsValues.SHIBBOLETH_VALIDATE);
//custom-attribute-list
PermissionChecker _oldChecker = PermissionThreadLocal.getPermissionChecker();
try {
if (_log.isDebugEnabled())
_log.debug("Setto i permessi per i Custom Attribute.");
PermissionChecker _permissionChecker = PermissionCheckerFactoryUtil.create(user, false);
PermissionThreadLocal.setPermissionChecker(_permissionChecker);
user.getExpandoBridge().setAttribute(LiferayCustomAttributeKeys.FISCAL_CODE_NAME, _fiscalcode);
user.getExpandoBridge().setAttribute(LiferayCustomAttributeKeys.PEC_CODE_NAME, _pec);
user.getExpandoBridge().setAttribute(LiferayCustomAttributeKeys.BIRTHPLACE_CODE_NAME, _birthplace);
user.getExpandoBridge().setAttribute(LiferayCustomAttributeKeys.BIRTHPLACE_STATO_CODE_NAME, _birthplace_stato);
if (_log.isDebugEnabled())
_log.debug("Settati i Custom Attribute base.");
user.getExpandoBridge().setAttribute(LiferayCustomAttributeKeys.TELEPHONE_CODE_NAME, _telephonenumber);
user.getExpandoBridge().setAttribute(LiferayCustomAttributeKeys.MOBILE_PHONE_CODE_NAME, _cellularnumber);
if (_log.isDebugEnabled())
_log.debug("Settati i Custom Attribute contatti telefonici.");
user.getExpandoBridge().setAttribute(LiferayCustomAttributeKeys.VALIDATE_CODE_NAME, _validate);
if (_log.isDebugEnabled())
_log.debug("Settato il Custom Attribute validate.");
} catch (Exception ex) {
_log.error(ex, ex);
} finally {
PermissionThreadLocal.setPermissionChecker(_oldChecker);
}
if (_log.isDebugEnabled())
_log.debug("[END] Setto i Custom Attribute.");
}