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


Java PermissionChecker.hasPermission方法代码示例

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


在下文中一共展示了PermissionChecker.hasPermission方法的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: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: authorize

import com.liferay.portal.security.permission.PermissionChecker; //导入方法依赖的package包/类
@Override
public boolean authorize(IContext context) {
      try {
           User user = context.find(ILiferayCommandKeys.LIFERAY_USER);
           if (user == null) return false;
           
           PermissionChecker permissionChecker = context.find(ILiferayCommandKeys.LIFERAY_PERMISSION_CHECKER);
           if (permissionChecker == null) {
               _logger.error("Could not find permission checker for user="+user.getEmailAddress());
               return false;
           }
           
           List<Organization> userOrgs =
                   OrganizationLocalServiceUtil.getUserOrganizations(user.getUserId());
           for (Organization userOrg : userOrgs) {
               boolean hasPermission =
                       permissionChecker.hasPermission(userOrg.getGroupId(), "33", 0, "VIEW");
               if (hasPermission) {
                   return true;
               }
           }
       }  catch (SystemException e) {e.printStackTrace(); }

       return false;
}
 
开发者ID:xtivia,项目名称:xsf,代码行数:26,代码来源:OrgAuthorizedCommand.java

示例10: 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

示例11: 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,代码来源:SurveyActivity.java

示例12: contains

import com.liferay.portal.security.permission.PermissionChecker; //导入方法依赖的package包/类
public static boolean contains(
		PermissionChecker permissionChecker, long artistId, String actionId)
	throws PortalException {

	Artist artist = ArtistLocalServiceUtil.getArtist(artistId);

	Boolean hasPermission = StagingPermissionUtil.hasPermission(
		permissionChecker, artist.getGroupId(), Artist.class.getName(),
		artist.getArtistId(), AlbumsPortlet.PORTLET_ID, actionId);

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

	return permissionChecker.hasPermission(
		artist.getGroupId(), Artist.class.getName(), artist.getArtistId(),
		actionId);
}
 
开发者ID:juliocamarero,项目名称:jukebox-portlet,代码行数:19,代码来源:ArtistPermission.java

示例13: contains

import com.liferay.portal.security.permission.PermissionChecker; //导入方法依赖的package包/类
public static boolean contains(
		PermissionChecker permissionChecker, Album album, String actionId)
	throws PortalException {

	Boolean hasPermission = StagingPermissionUtil.hasPermission(
		permissionChecker, album.getGroupId(), Album.class.getName(),
		album.getAlbumId(), AlbumsPortlet.PORTLET_ID, actionId);

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

	return permissionChecker.hasPermission(
		album.getGroupId(), Album.class.getName(), album.getAlbumId(),
		actionId);
}
 
开发者ID:juliocamarero,项目名称:jukebox-portlet,代码行数:17,代码来源:AlbumPermission.java

示例14: contains

import com.liferay.portal.security.permission.PermissionChecker; //导入方法依赖的package包/类
public static boolean contains(
		PermissionChecker permissionChecker, long songId, String actionId)
	throws PortalException {

	Song song = SongLocalServiceUtil.getSong(songId);

	Boolean hasPermission = StagingPermissionUtil.hasPermission(
		permissionChecker, song.getGroupId(), Song.class.getName(),
		song.getSongId(), AlbumsPortlet.PORTLET_ID, actionId);

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

	return permissionChecker.hasPermission(
		song.getGroupId(), Song.class.getName(), song.getSongId(),
		actionId);
}
 
开发者ID:juliocamarero,项目名称:jukebox-portlet,代码行数:19,代码来源:SongPermission.java

示例15: contains

import com.liferay.portal.security.permission.PermissionChecker; //导入方法依赖的package包/类
public static boolean contains(
		PermissionChecker permissionChecker, long artistId, String actionId)
	throws PortalException, SystemException {

	Artist artist = ArtistLocalServiceUtil.getArtist(artistId);

	Boolean hasPermission = StagingPermissionUtil.hasPermission(
		permissionChecker, artist.getGroupId(), Artist.class.getName(),
		artist.getArtistId(), AlbumsPortlet.PORTLET_ID, actionId);

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

	return permissionChecker.hasPermission(
		artist.getGroupId(), Artist.class.getName(), artist.getArtistId(),
		actionId);
}
 
开发者ID:juliocamarero,项目名称:jukebox,代码行数:19,代码来源:ArtistPermission.java


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