本文整理汇总了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;
}
示例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;
}
示例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");
}
}
}
示例4: isSuperUser
import com.liferay.portal.theme.ThemeDisplay; //导入方法依赖的package包/类
public static boolean isSuperUser(ThemeDisplay themeDisplay)
{
return (themeDisplay.isSignedIn() &&
(themeDisplay.getPermissionChecker().isOmniadmin() ||
themeDisplay.getPermissionChecker().isCompanyAdmin()));
}
示例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");
}