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


Java PermissionChecker类代码示例

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


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

示例1: areThereTriesNotFromEditors

import com.liferay.portal.security.permission.PermissionChecker; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public boolean areThereTriesNotFromEditors(LearningActivity activity) throws Exception
{ 		
	boolean resp = false;
	List<User> users = getUsersByLearningActivity(activity.getActId());
	for(User usu:users){
		PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(usu);
		if(!(permissionChecker.hasPermission(activity.getGroupId(),"com.liferay.lms.model",activity.getGroupId(),"UPDATE_ACTIVE")||
				permissionChecker.hasPermission(activity.getGroupId(),LearningActivity.class.getName(),activity.getActId(),ActionKeys.UPDATE)||
				permissionChecker.hasOwnerPermission(activity.getCompanyId(),LearningActivity.class.getName(),activity.getActId(),activity.getUserId(),ActionKeys.UPDATE))){
			resp = true;
			break;
		}
	}
	return resp;		
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:17,代码来源:LearningActivityTryLocalServiceImpl.java

示例2: canAccessLock

import com.liferay.portal.security.permission.PermissionChecker; //导入依赖的package包/类
/**
 * Comprueba si un usuario puede acceder a los cursos/modulos/actividades bloqueadas
 * @param groupCreatedId id del grupo creado para el curso
 * @param user usuario
 * @return true en caso de que pueda acceder a bloqueados
 */

public boolean canAccessLock(long groupCreatedId, User user){
	//Si es administrador
	if(PortalUtil.isOmniadmin(user.getUserId())){
		return true;
	}

	PermissionChecker permissionChecker = null;
	try {
		permissionChecker = PermissionCheckerFactoryUtil.create(user);
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	
	//Si tiene permiso ACCESSLOCK
	
	if(permissionChecker != null && permissionChecker.hasPermission(groupCreatedId, "com.liferay.lms.model",groupCreatedId,"ACCESSLOCK")){
		return true;
	}
	
	return false;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:30,代码来源:CourseLocalServiceImpl.java

示例3: getAllEntities

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

示例4: getRegionEntitiesForWidget

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

示例5: getRegionEntitiesForWidgetParamFirst

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

示例6: getOpenDataEntitiesForWidget

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

示例7: getVisibleActivities

import com.liferay.portal.security.permission.PermissionChecker; //导入依赖的package包/类
public static List<LearningActivity> getVisibleActivities(ThemeDisplay themeDisplay,
		List<LearningActivity> res, PermissionChecker permissionChecker)
		throws PortalException, SystemException {
	List<LearningActivity> res2 = null;
	if(res != null && res.size()>0){
		res2 = new ArrayList<LearningActivity>();
		res2.addAll(res);
		Role siteMemberRole = RoleLocalServiceUtil.getRole(themeDisplay.getCompanyId(), RoleConstants.SITE_MEMBER);
		for(java.util.ListIterator<LearningActivity> itr = res2.listIterator(); itr.hasNext();){
			LearningActivity activity = itr.next();
			try {
				if(!ResourcePermissionLocalServiceUtil.hasResourcePermission(activity.getCompanyId(), LearningActivity.class.getName(), 
						ResourceConstants.SCOPE_INDIVIDUAL,	Long.toString(activity.getActId()),siteMemberRole.getRoleId(), ActionKeys.VIEW)
						&& !permissionChecker.hasPermission(activity.getGroupId(), LearningActivity.class.getName(), activity.getActId() , "CORRECT"))
					itr.remove();
			} catch (SystemException e) {
				e.printStackTrace();
			}
		}
	}
	return res2;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:23,代码来源:LiferaylmsUtil.java

示例8: upmodule

import com.liferay.portal.security.permission.PermissionChecker; //导入依赖的package包/类
public void upmodule(ActionRequest actionRequest, ActionResponse actionResponse)
throws Exception {

	long moduleId = ParamUtil.getLong(actionRequest, "resId",0);
	ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
	PermissionChecker permissionChecker=themeDisplay.getPermissionChecker();
	long userIdAction = themeDisplay.getUserId();
	if(moduleId>0)
	{
		if(permissionChecker.hasPermission(
	
			themeDisplay.getScopeGroupId(),
			Module.class.getName(), moduleId,
			ActionKeys.UPDATE))
		{
			ModuleLocalServiceUtil.goUpModule(moduleId, userIdAction);
		}
	}
	
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:21,代码来源:LmsActivitiesList.java

示例9: downmodule

import com.liferay.portal.security.permission.PermissionChecker; //导入依赖的package包/类
public void downmodule(ActionRequest actionRequest, ActionResponse actionResponse)
throws Exception {
	ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
	PermissionChecker permissionChecker=themeDisplay.getPermissionChecker();
	
	long moduleId = ParamUtil.getLong(actionRequest, "resId",0);
	long userIdAction = themeDisplay.getUserId();
	if(moduleId>0)
	{
		if(permissionChecker.hasPermission(
			themeDisplay.getScopeGroupId(),
			Module.class.getName(), moduleId,
			ActionKeys.UPDATE))
		{
		ModuleLocalServiceUtil.goDownModule(moduleId,userIdAction);
		}
	}
	
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:20,代码来源:LmsActivitiesList.java

示例10: moveModule

import com.liferay.portal.security.permission.PermissionChecker; //导入依赖的package包/类
public void moveModule(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
	
	ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
	PermissionChecker permissionChecker=themeDisplay.getPermissionChecker();
	long userIdAction = themeDisplay.getUserId();
	long moduleId = ParamUtil.getLong(actionRequest, "pageId"),
	     prevModId = ParamUtil.getLong(actionRequest, "prevPageId"),
	     nextModId = ParamUtil.getLong(actionRequest, "nextPageId");
	
	if(moduleId>0){
		if(permissionChecker.hasPermission(themeDisplay.getScopeGroupId(), Module.class.getName(), moduleId, ActionKeys.UPDATE)){
			ModuleLocalServiceUtil.moveModule(moduleId, prevModId, nextModId,userIdAction);
		}
	}
	
	actionResponse.setRenderParameter("jsp", "/html/lmsactivitieslist/view.jsp");
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:18,代码来源:LmsActivitiesList.java

示例11: moveActivity

import com.liferay.portal.security.permission.PermissionChecker; //导入依赖的package包/类
public void moveActivity(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
	
	ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
	PermissionChecker permissionChecker=themeDisplay.getPermissionChecker();
	
	long actId = ParamUtil.getLong(actionRequest, "pageId"),
	     prevActId = ParamUtil.getLong(actionRequest, "prevPageId"),
	     nextActId = ParamUtil.getLong(actionRequest, "nextPageId");
	
	if(actId>0){
		LearningActivity larn = LearningActivityLocalServiceUtil.getLearningActivity(actId);
		
		if(permissionChecker.hasPermission(larn.getGroupId(), LearningActivity.class.getName(), larn.getActId(), ActionKeys.UPDATE)|| 
				permissionChecker.hasOwnerPermission(larn.getCompanyId(), LearningActivity.class.getName(), larn.getActId(),larn.getUserId(), ActionKeys.UPDATE)){
			LearningActivityLocalServiceUtil.moveActivity(actId, prevActId, nextActId, themeDisplay.getUserId());
		}
	}
	
	actionResponse.setRenderParameter("jsp", "/html/lmsactivitieslist/view.jsp");
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:21,代码来源:LmsActivitiesList.java

示例12: upquestion

import com.liferay.portal.security.permission.PermissionChecker; //导入依赖的package包/类
public void upquestion(ActionRequest actionRequest, ActionResponse actionResponse)
throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
	
	PermissionChecker permissionChecker=themeDisplay.getPermissionChecker();
	
	long actId = ParamUtil.getLong(actionRequest, "actId",0);
	long testQuestionId = ParamUtil.getLong(actionRequest, "questionId");
	
	if(actId>0)
	{	
		LearningActivity larn = LearningActivityLocalServiceUtil.getLearningActivity(actId);
	
		if(permissionChecker.hasPermission(larn.getGroupId(), LearningActivity.class.getName(), larn.getActId(),
				ActionKeys.UPDATE)|| permissionChecker.hasOwnerPermission(larn.getCompanyId(), LearningActivity.class.getName(), larn.getActId(),larn.getUserId(),
						ActionKeys.UPDATE))
		{
		TestQuestionLocalServiceUtil.goUpTestQuestion(testQuestionId);
		}
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:22,代码来源:ExecActivity.java

示例13: downquestion

import com.liferay.portal.security.permission.PermissionChecker; //导入依赖的package包/类
public void downquestion(ActionRequest actionRequest, ActionResponse actionResponse)
throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
	
	PermissionChecker permissionChecker=themeDisplay.getPermissionChecker();
	
	long actId = ParamUtil.getLong(actionRequest, "actId",0);
	long testQuestionId = ParamUtil.getLong(actionRequest, "questionId");

	if(actId>0)
	{
		LearningActivity larn = LearningActivityLocalServiceUtil.getLearningActivity(actId);
		
		if(permissionChecker.hasPermission(larn.getGroupId(), LearningActivity.class.getName(), larn.getActId(),
				ActionKeys.UPDATE)|| permissionChecker.hasOwnerPermission(larn.getCompanyId(), LearningActivity.class.getName(), larn.getActId(),larn.getUserId(),
						ActionKeys.UPDATE))
		{
			TestQuestionLocalServiceUtil.goDownTestQuestion(testQuestionId);
		}
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:22,代码来源:ExecActivity.java

示例14: canAccess

import com.liferay.portal.security.permission.PermissionChecker; //导入依赖的package包/类
/**
 * Comprueba si se peude accceder a una actividad
 * @param viewActivityFinish Si la actividad deja acceder coon el modo observador
 * @return
 */

public boolean canAccess(boolean viewActivityFinish, User user, PermissionChecker permissionChecker){
	boolean canAccessLock = CourseLocalServiceUtil.canAccessLock(this.getGroupId(), user);
	boolean hasPermissionAccessCourseFinished = false;
	
	Course course;
	try {
		course = CourseLocalServiceUtil.fetchByGroupCreatedId(this.getGroupId());
	} catch (SystemException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
		return false;
	}
	
	if(viewActivityFinish)
		hasPermissionAccessCourseFinished = LiferaylmsUtil.hasPermissionAccessCourseFinished(this.getCompanyId(), this.getGroupId(), course.getCourseId(), user.getUserId());
	
	return canAccess(viewActivityFinish, user, permissionChecker, canAccessLock, course, hasPermissionAccessCourseFinished);
	
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:26,代码来源:LearningActivityImpl.java

示例15: upquestion

import com.liferay.portal.security.permission.PermissionChecker; //导入依赖的package包/类
public void upquestion(ActionRequest actionRequest, ActionResponse actionResponse)
		throws Exception {
	ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

	PermissionChecker permissionChecker=themeDisplay.getPermissionChecker();

	long actId = ParamUtil.getLong(actionRequest, "actId",0);
	long testQuestionId = ParamUtil.getLong(actionRequest, "questionId");

	if(actId>0)
	{	
		LearningActivity larn = LearningActivityLocalServiceUtil.getLearningActivity(actId);

		if(permissionChecker.hasPermission(larn.getGroupId(), LearningActivity.class.getName(), larn.getActId(),
				ActionKeys.UPDATE)|| permissionChecker.hasOwnerPermission(larn.getCompanyId(), LearningActivity.class.getName(), larn.getActId(),larn.getUserId(),
						ActionKeys.UPDATE))
		{
			TestQuestionLocalServiceUtil.goUpTestQuestion(testQuestionId);
		}
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:22,代码来源:SurveyActivity.java


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