• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PermissionThreadLocal类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.liferay.portal.security.permission.PermissionThreadLocal的典型用法代码示例。如果您正苦于以下问题:Java PermissionThreadLocal类的具体用法?Java PermissionThreadLocal怎么用?Java PermissionThreadLocal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PermissionThreadLocal类属于com.liferay.portal.security.permission包,在下文中一共展示了PermissionThreadLocal类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: receive

import com.liferay.portal.security.permission.PermissionThreadLocal; //导入依赖的package包/类
@Override
public void receive(Message message) throws MessageListenerException {
	
	try {
		this.groupId	= message.getLong("groupId");
		this.fileName = message.getString("fileName");
		this.key = message.getString(key);
		this.serviceContext = (ServiceContext)message.get("serviceContext");
		this.themeDisplay = (ThemeDisplay)message.get("themeDisplay");
	
		Role adminRole = RoleLocalServiceUtil.getRole(themeDisplay.getCompanyId(),"Administrator");
		List<User> adminUsers = UserLocalServiceUtil.getRoleUsers(adminRole.getRoleId());
		 
		PrincipalThreadLocal.setName(adminUsers.get(0).getUserId());
		PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(adminUsers.get(0));
		PermissionThreadLocal.setPermissionChecker(permissionChecker);
	
		MultiVMPoolUtil.put("exportCourseCache", key, true);
		try {
			doExportCourse();
		} finally {
			MultiVMPoolUtil.remove("exportCourseCache", key);
		}
		
		
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:30,代码来源:ExportCourse.java


示例2: receive

import com.liferay.portal.security.permission.PermissionThreadLocal; //导入依赖的package包/类
@Override
public void receive(Message message) throws MessageListenerException {
	
	try {
		
		this.groupId	= message.getLong("groupId");
		this.newCourseName = message.getString("newCourseName");
		this.startDate 	= (Date)message.get("startDate");
		this.endDate 	= (Date)message.get("endDate");
		this.serviceContext = (ServiceContext)message.get("serviceContext");
		this.themeDisplay = (ThemeDisplay)message.get("themeDisplay");
		this.childCourse =(Boolean)message.get("childCourse");
		this.visible = message.getBoolean("visible");
		this.includeTeacher = message.getBoolean("includeTeacher");
		this.cloneForum = message.getBoolean("cloneForum");
		Role adminRole = RoleLocalServiceUtil.getRole(themeDisplay.getCompanyId(),"Administrator");
		List<User> adminUsers = UserLocalServiceUtil.getRoleUsers(adminRole.getRoleId());
		 
		PrincipalThreadLocal.setName(adminUsers.get(0).getUserId());
		PermissionChecker permissionChecker =PermissionCheckerFactoryUtil.create(adminUsers.get(0), true);
		PermissionThreadLocal.setPermissionChecker(permissionChecker);
	
		doCloneCourse();
		
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:29,代码来源:CloneCourse.java


示例3: receive

import com.liferay.portal.security.permission.PermissionThreadLocal; //导入依赖的package包/类
@Override
public void receive(Message message) throws MessageListenerException {
	
	try {
		
		this.newEditionName = message.getString("newEditionName");
		this.startDate 	= (Date)message.get("startDate");
		this.endDate 	= (Date)message.get("endDate");
		this.serviceContext = (ServiceContext)message.get("serviceContext");
		this.themeDisplay = (ThemeDisplay)message.get("themeDisplay");
		this.parentCourseId = (Long)message.get("parentCourseId");
		this.isLinked = (Boolean)message.get("isLinked");
		this.startExecutionDate = (Date) message.get("startExecutionDate");
		this.endExecutionDate = (Date) message.get("endExecutionDate");
		this.editionFriendlyURL = (String)message.get("editionFriendlyURL");
		this.editionLayoutId = (Long)message.get("editionLayoutId");
		log.debug("Parent Course Id: "+parentCourseId);
		Role adminRole = RoleLocalServiceUtil.getRole(themeDisplay.getCompanyId(),"Administrator");
		List<User> adminUsers = UserLocalServiceUtil.getRoleUsers(adminRole.getRoleId());
		 
		PrincipalThreadLocal.setName(adminUsers.get(0).getUserId());
		PermissionChecker permissionChecker =PermissionCheckerFactoryUtil.create(adminUsers.get(0));
		PermissionThreadLocal.setPermissionChecker(permissionChecker);
	
		doCreateEdition();
		
		
		
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:33,代码来源:CreateEdition.java


示例4: setIndividualScopePermissions

import com.liferay.portal.security.permission.PermissionThreadLocal; //导入依赖的package包/类
public void setIndividualScopePermissions(
		long companyId, long groupId, String name, long primKey,
		Map<Long, String[]> roleIdsToActionIds)
	throws PortalException, SystemException {

	boolean flushEnabled = PermissionThreadLocal.isFlushEnabled();

	PermissionThreadLocal.setIndexEnabled(false);

	try {
		PermissionedModel permissionedModel = getPermissionedModel(
			name, primKey);

		for (Map.Entry<Long, String[]> entry :
				roleIdsToActionIds.entrySet()) {

			long roleId = entry.getKey();
			String[] actionIds = entry.getValue();

			updateIndividualScopePermissions(
				companyId, groupId, name, permissionedModel, roleId,
				getActionIds(name, ListUtil.fromArray(actionIds)),
				ResourceBlockConstants.OPERATOR_SET);
		}
	}
	finally {
		PermissionThreadLocal.setIndexEnabled(flushEnabled);

		PermissionCacheUtil.clearCache();
	}
}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:32,代码来源:ResourceBlockLocalServiceImpl.java


示例5: _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;
}
 
开发者ID:slemarchand,项目名称:page-composer-hook,代码行数:11,代码来源:ThemeSwitchServicePreAction.java


示例6: _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.");
}
 
开发者ID:publisys-spa,项目名称:shibboleth-spid-login-hook,代码行数:61,代码来源:ShibbolethAutoLogin.java



注:本文中的com.liferay.portal.security.permission.PermissionThreadLocal类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MapBindingSet类代码示例发布时间:2022-05-22
下一篇:
Java JobPrioritySupported类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap