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


Java PermissionChecker.hasOwnerPermission方法代码示例

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


在下文中一共展示了PermissionChecker.hasOwnerPermission方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

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

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

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

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

示例7: contains

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

	if (permissionChecker.hasOwnerPermission(
			proc.getCompanyId(), DossierProc.class.getName(),
			proc.getDossierProcId(), proc.getUserId(), actionId)) {

		return true;
	}

	return permissionChecker.hasPermission(
		proc.getGroupId(), DossierProc.class.getName(), proc.getDossierProcId(),
		actionId);
}
 
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:16,代码来源:DossierProcPermission.java

示例8: _hasPermission

import com.liferay.portal.security.permission.PermissionChecker; //导入方法依赖的package包/类
/***
 * This function was taken from JournalFolderPermission which is located in
 * portal-impl.
 * 
 * @param permissionChecker
 * @param folder
 * @param actionId
 * @return
 */
private static boolean _hasPermission(PermissionChecker permissionChecker, JournalFolder folder, String actionId) {

    if (permissionChecker.hasOwnerPermission(folder.getCompanyId(), JournalFolder.class.getName(),
            folder.getFolderId(), folder.getUserId(), actionId)
            || permissionChecker.hasPermission(folder.getGroupId(), JournalFolder.class.getName(),
                    folder.getFolderId(), actionId)) {

        return true;
    }

    return false;
}
 
开发者ID:rivetlogic,项目名称:liferay-document-and-media-treeview,代码行数:22,代码来源:EnhancedJournalAppServiceImpl.java

示例9: hasJournalArticlePermission

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

示例10: deleteactivity

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

	long actId = ParamUtil.getLong(actionRequest, "resId");
	long renderActId = ParamUtil.getLong(actionRequest, "actId",0);
	long moduleId = ParamUtil.getLong(actionRequest, "moduleId", 0);

	ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

	PermissionChecker permissionChecker=themeDisplay.getPermissionChecker();

	log.debug("*****deleteactivity*****");
	
	actionResponse.removePublicRenderParameter("actionEditingActivity");
	actionResponse.removePublicRenderParameter("actionEditingModule");
	
	if(actId>0){
		LearningActivity larn = LearningActivityLocalServiceUtil.getLearningActivity(actId);
		if(moduleId<=0){
			moduleId = larn.getModuleId();
		}
		if(permissionChecker.hasPermission(larn.getGroupId(), LearningActivity.class.getName(), larn.getActId(),
				ActionKeys.DELETE)|| permissionChecker.hasOwnerPermission(larn.getCompanyId(), LearningActivity.class.getName(), larn.getActId(),larn.getUserId(),
						ActionKeys.DELETE))
		{
			deleteActivity(larn,themeDisplay,actionRequest,actionResponse);
			SessionMessages.add(actionRequest, "ok-deleteActivity");
			if(actId==renderActId) {
				List<LearningActivity> activities = LearningActivityLocalServiceUtil.getLearningActivitiesOfModule(moduleId);
				actionResponse.removePublicRenderParameter("actId");		
				if(activities!=null && activities.size()>0){
					actionResponse.setRenderParameter("actId", String.valueOf(activities.get(0).getActId()));
					actionResponse.setRenderParameter("resId", String.valueOf(activities.get(0).getActId()));
				}else{
					actionResponse.setRenderParameter("actId", "0");
					actionResponse.setRenderParameter("resId", "0");
					actionResponse.setRenderParameter("moduleId", String.valueOf(moduleId));
				}
			}
			
			/*
			if(!LiferayWindowState.EXCLUSIVE.equals(actionRequest.getWindowState())){
				actionResponse.sendRedirect(
						((LiferayPortletResponse)actionResponse).createRenderURL().toString());
				
			}
			*/
		}
	}

}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:52,代码来源:LmsActivitiesList.java

示例11: serveResource

import com.liferay.portal.security.permission.PermissionChecker; //导入方法依赖的package包/类
public void serveResource(ResourceRequest request, ResourceResponse response) throws PortletException,IOException{
	
	ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);
	
	long actId = ParamUtil.getLong(request, "actId");
	String action = ParamUtil.getString(request, "action");

	log.error("Act ID "+actId);
	PermissionChecker permissionChecker=themeDisplay.getPermissionChecker();
	JSONObject oreturned = JSONFactoryUtil.createJSONObject();	
	boolean changed=false;
	if(actId>0)
	{	
		try{
			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))
			{
				if(action.equals("down")){
					LearningActivityLocalServiceUtil.goDownLearningActivity(actId, themeDisplay.getUserId());
					changed=true;	
				}else if(action.equals("up")){
					LearningActivityLocalServiceUtil.goUpLearningActivity(actId, themeDisplay.getUserId());
					changed=true;
				}
				
			}								
		}catch(Exception e){
			e.printStackTrace();
			throw new PortletException(e.getMessage());
		}
	}
	if(changed){
		oreturned.put("success", "OK");
		PrintWriter out = response.getWriter();
		out.print(oreturned.toString());
		out.flush();
		out.close();
	}
	
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:43,代码来源:LmsActivitiesList.java

示例12: canBeEdited

import com.liferay.portal.security.permission.PermissionChecker; //导入方法依赖的package包/类
public boolean canBeEdited(LearningActivity activity, PermissionChecker permissionChecker) throws Exception{
	//Si tengo permiso de editar bloqueados, es editable
	if(permissionChecker.hasPermission(activity.getGroupId(),LearningActivity.class.getName(),activity.getActId(),"UPDATE_ACTIVE")){
		return true;
	//Si tengo permiso de edici�n
	}else if(permissionChecker.hasPermission(activity.getGroupId(),LearningActivity.class.getName(),activity.getActId(),ActionKeys.UPDATE)||
			permissionChecker.hasOwnerPermission(activity.getCompanyId(),LearningActivity.class.getName(),activity.getActId(),activity.getUserId(),ActionKeys.UPDATE)){
		//y no hay intentos de la actividad por parte de alumnos
		if(!LearningActivityTryLocalServiceUtil.areThereTriesNotFromEditors(activity)){
			Date today = new Date();
			Module module = ModuleLocalServiceUtil.getModule(activity.getModuleId());
			if(module.getStartDate() != null && module.getEndDate() != null){//xq la fecha en los modulos es obligatoria
				//Si estoy fuera del intervalo de fechas de la actividad, o del m�dulo en caso de no estar alguna definida en la actividad, es editable
				if(
						(
								(activity.getStartdate()==null && (today.compareTo(module.getStartDate())<0)) 
								||
								(activity.getStartdate()!=null && (today.compareTo(activity.getStartdate())<0))
						) 
						||
						(
								(activity.getEnddate()==null && (today.compareTo(module.getEndDate())>0))
								||
								(activity.getEnddate()!=null && (today.compareTo(activity.getEnddate())>0))
						)
				){return true;}
				//Si estoy dentro del intervalo de fechas de la actividad, o del m�dulo en caso de no estar definida en la actividad, compruebo si existe ojo y si este est� cerrado, entonces es editable
				if(
						((activity.getStartdate()==null && (today.compareTo(module.getStartDate())>=0))||
						(activity.getStartdate()!=null && (today.compareTo(activity.getStartdate())>=0))) &&
						((activity.getEnddate()==null && (today.compareTo(module.getEndDate())<=0))||
						(activity.getEnddate()!=null && (today.compareTo(activity.getEnddate())<=0)))
				){
					if(LmsPrefsLocalServiceUtil.getLmsPrefs(activity.getCompanyId()).getShowHideActivity()){
						Role siteMemberRole = RoleLocalServiceUtil.getRole(activity.getCompanyId(), RoleConstants.SITE_MEMBER);
						if(!ResourcePermissionLocalServiceUtil.hasResourcePermission(activity.getCompanyId(), LearningActivity.class.getName(), 
								ResourceConstants.SCOPE_INDIVIDUAL,	Long.toString(activity.getActId()),siteMemberRole.getRoleId(), ActionKeys.VIEW)){
							return true;
						}
					}
				}
			}
		}
	}
	
	
	return false;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:49,代码来源:LearningActivityLocalServiceImpl.java


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