当前位置: 首页>>代码示例>>Java>>正文


Java ThemeDisplay.isSignedIn方法代码示例

本文整理汇总了Java中com.liferay.portal.theme.ThemeDisplay.isSignedIn方法的典型用法代码示例。如果您正苦于以下问题:Java ThemeDisplay.isSignedIn方法的具体用法?Java ThemeDisplay.isSignedIn怎么用?Java ThemeDisplay.isSignedIn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.liferay.portal.theme.ThemeDisplay的用法示例。


在下文中一共展示了ThemeDisplay.isSignedIn方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isLoggedInMgmt

import com.liferay.portal.theme.ThemeDisplay; //导入方法依赖的package包/类
/**
 * Checks if is logged in mgmt.
 *
 * @param request the request
 * @return true, if is logged in mgmt
 */
protected boolean isLoggedInMgmt(final PortletRequest request) {
	boolean result = false;
	final ThemeDisplay themeDisplay = (ThemeDisplay) request
	        .getAttribute(WebKeys.THEME_DISPLAY);
	if (themeDisplay.isSignedIn()) {
		final User user = themeDisplay.getUser();
		if (user != null) {
			try {
				final List<Role> roles = user.getRoles();
				String mgmtRoleName = CustomPortalServiceHandler.getConfigValue(E_ConfigKey.ROLE_NAME_MGMT);
				for (final Role role : roles) {
					if (role.getName().equals(mgmtRoleName)) {
						result = true;
						break;
					}
				}
			} catch (final Throwable t) {
			}
		}
	}
	return result;
}
 
开发者ID:fraunhoferfokus,项目名称:particity,代码行数:29,代码来源:BaseController.java

示例2: isLoggedInOrg

import com.liferay.portal.theme.ThemeDisplay; //导入方法依赖的package包/类
/**
 * Checks if is logged in org.
 *
 * @param request the request
 * @return true, if is logged in org
 */
protected boolean isLoggedInOrg(final PortletRequest request) {
	boolean result = false;
	final ThemeDisplay themeDisplay = (ThemeDisplay) request
	        .getAttribute(WebKeys.THEME_DISPLAY);
	if (themeDisplay.isSignedIn()) {
		final User user = themeDisplay.getUser();
		if (user != null) {
			try {
				final List<Role> roles = user.getRoles();
				final String orgRoleName = CustomPortalServiceHandler.getConfigValue(E_ConfigKey.ROLE_NAME_ORG);
				for (final Role role : roles) {
					if (role.getName().equals(orgRoleName)) {
						result = true;
						break;
					}
				}
			} catch (final Throwable t) {
			}
		}
	}
	return result;
}
 
开发者ID:fraunhoferfokus,项目名称:particity,代码行数:29,代码来源:BaseController.java

示例3: inscribir

import com.liferay.portal.theme.ThemeDisplay; //导入方法依赖的package包/类
@ProcessAction(name = "inscribir") 
public void inscribir(ActionRequest request, ActionResponse response) throws Exception{

	ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);
	if (!themeDisplay.isSignedIn()) {return;}

	long teamId = ParamUtil.getLong(request, "teamId",0);
	long groupId = themeDisplay.getScopeGroupId();	
   	
   	Course course = CourseLocalServiceUtil.getCourseByGroupCreatedId(groupId);
   	
   	log.debug("COURSE GROUP ID "+course.getGroupCreatedId());
   	log.debug("THEME DISPLAY GROUP "+groupId);
   	long userId = themeDisplay.getUserId();
   	
   	ServiceContext serviceContext=ServiceContextFactory.getInstance(request);
   	
   	String result = CourseLocalServiceUtil.addStudentToCourseByUserId(course.getCourseId(), userId, teamId, serviceContext);
   	
   	if(!result.equalsIgnoreCase("ok")){
   		if(result.equalsIgnoreCase("error-complete-course")){
   			SessionErrors.add(request, "inscription-error-max-users");
   		}else if(result.equalsIgnoreCase("error-private-course")){
   			SessionErrors.add(request, "inscription-error-syte-restricted");
   		}else if(result.equalsIgnoreCase("error-user-suscribed")){
   			SessionErrors.add(request, "inscription-error-already-enrolled");
   		}else{
   			SessionErrors.add(request, "inscription-error");
   		}
   	}
   }
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:32,代码来源:CommunityInscription.java

示例4: isSuperUser

import com.liferay.portal.theme.ThemeDisplay; //导入方法依赖的package包/类
public static boolean isSuperUser(ThemeDisplay themeDisplay)
{
	return (themeDisplay.isSignedIn() && 
			(themeDisplay.getPermissionChecker().isOmniadmin() ||
					themeDisplay.getPermissionChecker().isCompanyAdmin()));
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:7,代码来源:LiferayViewUtil.java

示例5: changeLayout

import com.liferay.portal.theme.ThemeDisplay; //导入方法依赖的package包/类
public void changeLayout(ActionRequest request, ActionResponse response) throws Exception
{

		try {
			ThemeDisplay themeDisplay = (ThemeDisplay) request
					.getAttribute(WebKeys.THEME_DISPLAY);
			if (!themeDisplay.isSignedIn()) {
				return;
			}
			String layoutid = ParamUtil.getString(request, "layoutid");
			Layout ellayout = LayoutLocalServiceUtil.getLayout(Long
					.parseLong(layoutid));

			Role siteMemberRole = RoleLocalServiceUtil.getRole(themeDisplay.getCompanyId(), RoleConstants.SITE_MEMBER);
			Role userRole = RoleLocalServiceUtil.getRole(themeDisplay.getCompanyId(), RoleConstants.USER);
			boolean visible = ResourcePermissionLocalServiceUtil.hasResourcePermission(siteMemberRole.getCompanyId(), Layout.class.getName(), 
					ResourceConstants.SCOPE_INDIVIDUAL, layoutid, new long[] {siteMemberRole.getRoleId(), userRole.getRoleId()}, ActionKeys.VIEW);
			if(!visible){	
				
				ResourcePermissionLocalServiceUtil.setResourcePermissions(
						themeDisplay.getCompanyId(),
						Layout.class.getName(),
						ResourceConstants.SCOPE_INDIVIDUAL,
						layoutid,
						siteMemberRole.getRoleId(),
						new String[] { ActionKeys.VIEW });
			} else {
				//ellayout.setHidden(true);
				ResourcePermissionLocalServiceUtil.removeResourcePermission(
						themeDisplay.getCompanyId(),
						Layout.class.getName(),
						ResourceConstants.SCOPE_INDIVIDUAL,
						layoutid,
						siteMemberRole.getRoleId(), ActionKeys.VIEW);
				ResourcePermissionLocalServiceUtil.removeResourcePermission(
						themeDisplay.getCompanyId(),
						Layout.class.getName(),
						ResourceConstants.SCOPE_INDIVIDUAL,
						layoutid,
						userRole.getRoleId(), ActionKeys.VIEW);
			}
			//LayoutLocalServiceUtil.updateLayout(ellayout);
		} catch (Exception e) {
			e.printStackTrace();
		}
		//response.setRenderParameters(request.getParameterMap());			
		response.setRenderParameter("jspPage", "/html/coursetoolsmanage/reload.jsp");		
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:49,代码来源:CourseToolsManage.java


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