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

Java PrincipalException类代码示例

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

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



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

示例1: getAllEntities

import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
public JSONArray getAllEntities()  {
	try {
		PermissionChecker pc = getPermissionChecker();
		long userId = pc.getUserId();
		_log.debug("userId: " + userId);
		_log.debug("pc.isSignedIn(): " + pc.isSignedIn());			
		_log.debug("getCompanyId: " + pc.getCompanyId());
		User _user = userLocalService.fetchUser(userId);
		_log.debug("_user.getFullName(): " + _user.getFullName());
		_log.debug("_user.isActive(): " + _user.isActive());
		_log.debug("_user.isAgreedToTermsOfUse(): " + _user.isAgreedToTermsOfUse());
		_log.debug("_user.isEmailAddressVerified(): " + _user.isEmailAddressVerified());
		_log.debug("_user.isLockout(): " + _user.isLockout());
		_log.debug("_user.isNew(): " + _user.isNew());
		
	} catch (PrincipalException pe) {
		pe.printStackTrace();
	} catch (SystemException se) {
		se.printStackTrace();
	}
	return ogpd_EntityLocalService.getOGPD_Entities();
}
 
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:23,代码来源:OGPD_EntityServiceImpl.java


示例2: getRegionEntitiesForWidget

import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
public JSONArray getRegionEntitiesForWidget(String regionID)  {
	try {
		PermissionChecker pc = getPermissionChecker();
		long userId = pc.getUserId();
		_log.debug("userId: " + userId);
		_log.debug("pc.isSignedIn(): " + pc.isSignedIn());			
		_log.debug("getCompanyId: " + pc.getCompanyId());
		User _user = userLocalService.fetchUser(userId);
		_log.debug("_user.getFullName(): " + _user.getFullName());
		_log.debug("_user.isActive(): " + _user.isActive());
		_log.debug("_user.isAgreedToTermsOfUse(): " + _user.isAgreedToTermsOfUse());
		_log.debug("_user.isEmailAddressVerified(): " + _user.isEmailAddressVerified());
		_log.debug("_user.isLockout(): " + _user.isLockout());
		_log.debug("_user.isNew(): " + _user.isNew());
		
	} catch (PrincipalException pe) {
		pe.printStackTrace();
	} catch (SystemException se) {
		se.printStackTrace();
	}
	return ogpd_EntityLocalService.getRegionEntitiesForWidget(regionID);
}
 
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:23,代码来源:OGPD_EntityServiceImpl.java


示例3: getRegionEntitiesForWidgetParamFirst

import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
public JSONArray getRegionEntitiesForWidgetParamFirst(String regionID, String name) {
	try {
		PermissionChecker pc = getPermissionChecker();
		long userId = pc.getUserId();
		_log.debug("userId: " + userId);
		_log.debug("pc.isSignedIn(): " + pc.isSignedIn());			
		_log.debug("getCompanyId: " + pc.getCompanyId());
		User _user = userLocalService.fetchUser(userId);
		_log.debug("_user.getFullName(): " + _user.getFullName());
		_log.debug("_user.isActive(): " + _user.isActive());
		_log.debug("_user.isAgreedToTermsOfUse(): " + _user.isAgreedToTermsOfUse());
		_log.debug("_user.isEmailAddressVerified(): " + _user.isEmailAddressVerified());
		_log.debug("_user.isLockout(): " + _user.isLockout());
		_log.debug("_user.isNew(): " + _user.isNew());
		
	} catch (PrincipalException pe) {
		pe.printStackTrace();
	} catch (SystemException se) {
		se.printStackTrace();
	}
	return ogpd_EntityLocalService.getRegionEntitiesForWidgetParamFirst(regionID, name);
}
 
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:23,代码来源:OGPD_EntityServiceImpl.java


示例4: getOpenDataEntitiesForWidget

import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
public JSONArray getOpenDataEntitiesForWidget()  {
	try {
		PermissionChecker pc = getPermissionChecker();
		long userId = pc.getUserId();
		_log.debug("userId: " + userId);
		_log.debug("pc.isSignedIn(): " + pc.isSignedIn());			
		_log.debug("getCompanyId: " + pc.getCompanyId());
		User _user = userLocalService.fetchUser(userId);
		_log.debug("_user.getFullName(): " + _user.getFullName());
		_log.debug("_user.isActive(): " + _user.isActive());
		_log.debug("_user.isAgreedToTermsOfUse(): " + _user.isAgreedToTermsOfUse());
		_log.debug("_user.isEmailAddressVerified(): " + _user.isEmailAddressVerified());
		_log.debug("_user.isLockout(): " + _user.isLockout());
		_log.debug("_user.isNew(): " + _user.isNew());
		
	} catch (PrincipalException pe) {
		pe.printStackTrace();
	} catch (SystemException se) {
		se.printStackTrace();
	}
	return ogpd_EntityLocalService.getOpenDataEntitiesForWidget();
}
 
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:23,代码来源:OGPD_EntityServiceImpl.java


示例5: removeStudentFromCourse

import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
@JSONWebService
public void removeStudentFromCourse(long courseId,String login) throws PrincipalException, PortalException, SystemException
{
	ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
	Course course=courseLocalService.getCourse(courseId);
	if(getPermissionChecker().hasPermission(course.getGroupId(),  Course.class.getName(),courseId,"ASSIGN_MEMBERS")&& ! course.isClosed())
	{
	
		User user = UserLocalServiceUtil.getUserByScreenName(serviceContext.getCompanyId(), login);
		GroupLocalServiceUtil.unsetUserGroups(user.getUserId(),new long[] { course.getGroupCreatedId() });

		//auditing
		AuditingLogFactory.audit(course.getCompanyId(), course.getGroupId(), Course.class.getName(), course.getCourseId(), serviceContext.getUserId(), AuditConstants.UNREGISTER, null);
		
	
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:18,代码来源:CourseServiceImpl.java


示例6: findExportedRoomsInCompany

import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
/**
 * Retorna todas as salas que tiveram seu histórico definido em uma
 * instancia do portal
 * 
 * @param companyId
 * @return
 * @throws SystemException
 */
public final ChatRoomBean[] findExportedRoomsInCompany(long companyId) throws SystemException {
	List<ChatRoom> rs = ChatRoomFinderUtil.findExportedRoomsInCompany(companyId);
	List<ChatRoomBean> retorno = new ArrayList<ChatRoomBean>();
	for (ChatRoom chatRoom : rs) {
		try {
			if (canView(chatRoom)) {
				retorno.add(convertToChatRoomBean(chatRoom, false, false, false));
			}
		} catch (PrincipalException e) {
			throw new SystemException("Erro ao checar permissão de visualizar.", e);
		}
	}

	ChatRoomBean[] result = new ChatRoomBean[(retorno.size())];
	return retorno.toArray(result);

}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:26,代码来源:ChatRoomServiceImpl.java


示例7: addVoto

import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
/**
 * Adiciona um voto na proposta especificada
 * 
 * @param propostaId
 * @throws PortalException
 * @throws SystemException
 */
@Override
public void addVoto(long propostaId) throws PortalException, SystemException {
	Proposta proposta = PropostaLocalServiceUtil.getProposta(propostaId);
	long groupId = proposta.getGroupId();
	User user = getGuestOrUser();
	if (user.isDefaultUser())
		return;

	PermissionChecker checker = getPermissionChecker();

	if (!PriorizacaoPermissionsUtil.hasPermission(checker, groupId, "VOTE"))
		throw new PrincipalException("Sem permissão para votar");

	VotoLocalServiceUtil.addVoto(propostaId, user.getUserId());
}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:23,代码来源:PriorizacaoServiceImpl.java


示例8: hasJournalFolderPermission

import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
/***
 * This was taken from JournalFolderPermission which is located in
 * portal-impl. The code was shortened because we are expecting to evaluate
 * just Delete and Update actions for now.
 * 
 * @param folder
 * @return true if it has permission the given action
 */
private boolean hasJournalFolderPermission(final JournalFolder folder, final String actionId) {

    PermissionChecker permissionChecker;
    try {
        permissionChecker = getPermissionChecker();
    } catch (PrincipalException e) {
        log.error(e);
        return false;
    }

    Boolean hasPermission = StagingPermissionUtil.hasPermission(permissionChecker, folder.getGroupId(),
            JournalFolder.class.getName(), folder.getFolderId(), PortletKeys.JOURNAL, actionId);

    if (hasPermission != null) {
        return hasPermission.booleanValue();
    }
    return _hasPermission(permissionChecker, folder, actionId);
}
 
开发者ID:rivetlogic,项目名称:liferay-document-and-media-treeview,代码行数:27,代码来源:EnhancedJournalAppServiceImpl.java


示例9: check

import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
public static void check(PermissionChecker permissionChecker, long groupId,
    String actionId) throws PortalException {

    if (!contains(permissionChecker, groupId, actionId)) {
        throw new PrincipalException();
    }
}
 
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:8,代码来源:DossierProcModelPermission.java


示例10: check

import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
public static void check(
		PermissionChecker permissionChecker, DossierProc proc,
		String actionId)
	throws PortalException {

	if (!contains(permissionChecker, proc, actionId)) {
		throw new PrincipalException();
	}
}
 
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:10,代码来源:DossierProcPermission.java


示例11: getApplicationsCount

import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
public int getApplicationsCount() throws SystemException, PrincipalException {
		_log.debug("getApplicationsCount: ");
//		PermissionChecker pc = getPermissionChecker();
//		_log.debug("userId: " + pc.getUserId());
//		_log.debug("getCompanyId: " + pc.getCompanyId());
		return applicationLocalService.getApplicationsCount(10154);
	}
 
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:8,代码来源:ApplicationServiceImpl.java


示例12: deleteVoto

import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
/**
 * Remove um voto na proposta especificada
 * 
 * @param propostaId
 * @throws PortalException
 * @throws SystemException
 */
public void deleteVoto(long propostaId) throws PortalException, SystemException {
	Proposta proposta = PropostaLocalServiceUtil.getProposta(propostaId);
	long groupId = proposta.getGroupId();
	User user = getGuestOrUser();
	if (user.isDefaultUser())
		return;
	PermissionChecker checker = getPermissionChecker();

	if (!PriorizacaoPermissionsUtil.hasPermission(checker, groupId, "VOTE"))
		throw new PrincipalException("Sem permissão para votar");
	
	VotoLocalServiceUtil.deleteVoto(propostaId, user.getUserId());
}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:21,代码来源:PriorizacaoServiceImpl.java


示例13: _getPermissionChecker

import com.liferay.portal.security.auth.PrincipalException; //导入依赖的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


示例14: check

import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
public static void check(
		PermissionChecker permissionChecker, long artistId, String actionId)
	throws PortalException {

	if (!contains(permissionChecker, artistId, actionId)) {
		throw new PrincipalException();
	}
}
 
开发者ID:juliocamarero,项目名称:jukebox-portlet,代码行数:9,代码来源:ArtistPermission.java


示例15: check

import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
public static void check(
		PermissionChecker permissionChecker, long groupId, String actionId)
	throws PortalException {

	if (!contains(permissionChecker, groupId, actionId)) {
		throw new PrincipalException();
	}
}
 
开发者ID:juliocamarero,项目名称:jukebox-portlet,代码行数:9,代码来源:JukeBoxPermission.java


示例16: check

import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
public static void check(
		PermissionChecker permissionChecker, Album album, String actionId)
	throws PortalException {

	if (!contains(permissionChecker, album, actionId)) {
		throw new PrincipalException();
	}
}
 
开发者ID:juliocamarero,项目名称:jukebox-portlet,代码行数:9,代码来源:AlbumPermission.java


示例17: check

import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
public static void check(
		PermissionChecker permissionChecker, long songId, String actionId)
	throws PortalException {

	if (!contains(permissionChecker, songId, actionId)) {
		throw new PrincipalException();
	}
}
 
开发者ID:juliocamarero,项目名称:jukebox-portlet,代码行数:9,代码来源:SongPermission.java


示例18: addAlbum

import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
public void addAlbum(ActionRequest request, ActionResponse response)
	throws Exception {

	UploadPortletRequest uploadPortletRequest =
		PortalUtil.getUploadPortletRequest(request);

	long artistId = ParamUtil.getLong(uploadPortletRequest, "artistId");
	String name = ParamUtil.getString(uploadPortletRequest, "name");
	int year = ParamUtil.getInteger(uploadPortletRequest, "year");

	InputStream inputStream = uploadPortletRequest.getFileAsStream("file");

	ServiceContext serviceContext = ServiceContextFactory.getInstance(
		Album.class.getName(), uploadPortletRequest);

	try {
		AlbumServiceUtil.addAlbum(
			artistId, name, year, inputStream, serviceContext);

		SessionMessages.add(request, "albumAdded");

		String redirect = ParamUtil.getString(
			uploadPortletRequest, "redirect");

		response.sendRedirect(redirect);
	}
	catch (Exception e) {
		SessionErrors.add(request, e.getClass().getName());

		if (e instanceof AlbumNameException ||
			e instanceof PrincipalException) {

			response.setRenderParameter(
				"jspPage", "/html/albums/edit_album.jsp");
		}
		else {
			response.setRenderParameter("jspPage", "/html/error.jsp");
		}
	}
}
 
开发者ID:juliocamarero,项目名称:jukebox-portlet,代码行数:41,代码来源:JukeboxPortlet.java


示例19: addArtist

import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
public void addArtist(ActionRequest request, ActionResponse response)
throws Exception {

	UploadPortletRequest uploadPortletRequest =
		PortalUtil.getUploadPortletRequest(request);

	String name = ParamUtil.getString(uploadPortletRequest, "name");

	String bio = ParamUtil.getString(uploadPortletRequest, "bio");

	InputStream inputStream = uploadPortletRequest.getFileAsStream(
		"file");

	ServiceContext serviceContext = ServiceContextFactory.getInstance(
		Artist.class.getName(), uploadPortletRequest);

	try {
		ArtistServiceUtil.addArtist(
			name, bio, inputStream, serviceContext);

		SessionMessages.add(request, "artistAdded");

		String redirect = ParamUtil.getString(
			uploadPortletRequest, "redirect");

		response.sendRedirect(redirect); }
	catch (Exception e) {
		SessionErrors.add(request, e.getClass().getName());

		if (e instanceof ArtistNameException ||
			e instanceof PrincipalException) {

			response.setRenderParameter(
				"jspPage", "/html/artists/edit_artist.jsp");
		}
		else {
			response.setRenderParameter("jspPage", "/html/error.jsp");
		}
	}
}
 
开发者ID:juliocamarero,项目名称:jukebox-portlet,代码行数:41,代码来源:JukeboxPortlet.java


示例20: hasJournalArticlePermission

import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
/***
 * This was taken from JournalArticlePermission which is located in
 * portal-impl. The code was shortened because we are expecting to evaluate
 * just Delete and Update actions for now.
 * 
 * @return
 */
private boolean hasJournalArticlePermission(final JournalArticle article, final String actionId) {

    PermissionChecker permissionChecker;
    try {
        permissionChecker = getPermissionChecker();
    } catch (PrincipalException e) {
        log.error(e);
        return false;
    }

    Boolean hasPermission = StagingPermissionUtil.hasPermission(permissionChecker, article.getGroupId(),
            JournalArticle.class.getName(), article.getResourcePrimKey(), PortletKeys.JOURNAL, actionId);

    if (hasPermission != null) {
        return hasPermission.booleanValue();
    }

    if (article.isPending()) {
        hasPermission = WorkflowPermissionUtil.hasPermission(permissionChecker, article.getGroupId(),
                JournalArticle.class.getName(), article.getResourcePrimKey(), actionId);

        if (hasPermission != null) {
            return hasPermission.booleanValue();
        }
    }

    if (permissionChecker.hasOwnerPermission(article.getCompanyId(), JournalArticle.class.getName(),
            article.getResourcePrimKey(), article.getUserId(), actionId)) {

        return true;
    }

    return permissionChecker.hasPermission(article.getGroupId(), JournalArticle.class.getName(),
            article.getResourcePrimKey(), actionId);
}
 
开发者ID:rivetlogic,项目名称:liferay-document-and-media-treeview,代码行数:43,代码来源:EnhancedJournalAppServiceImpl.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java PropertyDescriptor类代码示例发布时间:2022-05-22
下一篇:
Java LevelLoadEvent类代码示例发布时间: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