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


Java ServiceContext.setAddGuestPermissions方法代码示例

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


在下文中一共展示了ServiceContext.setAddGuestPermissions方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createIGFolders

import com.liferay.portal.service.ServiceContext; //导入方法依赖的package包/类
private long createIGFolders(PortletRequest request,long userId,long repositoryId) throws PortalException, SystemException{
//Variables for folder ids
Long igMainFolderId = 0L;
Long igPortletFolderId = 0L;
Long igRecordFolderId = 0L;
   //Search for folders
   boolean igMainFolderFound = false;
   boolean igPortletFolderFound = false;
   try {
   	//Get the main folder
   	Folder igMainFolder = DLAppLocalServiceUtil.getFolder(repositoryId,DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,IMAGEGALLERY_MAINFOLDER);
   	igMainFolderId = igMainFolder.getFolderId();
   	igMainFolderFound = true;
   	//Get the portlet folder
   	DLFolder igPortletFolder = DLFolderLocalServiceUtil.getFolder(repositoryId,igMainFolderId,IMAGEGALLERY_PORTLETFOLDER);
   	igPortletFolderId = igPortletFolder.getFolderId();
   	igPortletFolderFound = true;
   } catch (Exception ex) {
   }
   
ServiceContext serviceContext= ServiceContextFactory.getInstance( DLFolder.class.getName(), request);
//Damos permisos al archivo para usuarios de comunidad.
serviceContext.setAddGroupPermissions(true);
serviceContext.setAddGuestPermissions(true);
   //Create main folder if not exist
   if(!igMainFolderFound) {
   	Folder newImageMainFolder=DLAppLocalServiceUtil.addFolder(userId, repositoryId, 0, IMAGEGALLERY_MAINFOLDER, IMAGEGALLERY_MAINFOLDER_DESCRIPTION, serviceContext);
   	igMainFolderId = newImageMainFolder.getFolderId();
   	igMainFolderFound = true;
   }
   //Create portlet folder if not exist
   if(igMainFolderFound && !igPortletFolderFound){
   	Folder newImagePortletFolder = DLAppLocalServiceUtil.addFolder(userId, repositoryId, igMainFolderId, IMAGEGALLERY_PORTLETFOLDER, IMAGEGALLERY_PORTLETFOLDER_DESCRIPTION, serviceContext);	    	
   	igPortletFolderFound = true;
   	igPortletFolderId = newImagePortletFolder.getFolderId();
   }
   //Create this record folder
   if(igPortletFolderFound){
   	SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
   	Date date = new Date();
   	String igRecordFolderName=dateFormat.format(date)+StringPool.UNDERLINE+userId;
   	Folder newImageRecordFolder = DLAppLocalServiceUtil.addFolder(userId,repositoryId, igPortletFolderId,igRecordFolderName, igRecordFolderName, serviceContext);
   	igRecordFolderId = newImageRecordFolder.getFolderId();
   }
   return igRecordFolderId;
 }
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:47,代码来源:BaseCourseAdminPortlet.java

示例2: createIGFolders

import com.liferay.portal.service.ServiceContext; //导入方法依赖的package包/类
private long createIGFolders(PortletRequest request,long userId,long repositoryId) throws PortalException, SystemException{
	//Variables for folder ids
	Long igMainFolderId = 0L;
	Long igPortletFolderId = 0L;
	Long igRecordFolderId = 0L;
	//Search for folders
	boolean igMainFolderFound = false;
	boolean igPortletFolderFound = false;
	try {
		//Get the main folder
		Folder igMainFolder = DLAppLocalServiceUtil.getFolder(repositoryId,DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,IMAGEGALLERY_MAINFOLDER);
		igMainFolderId = igMainFolder.getFolderId();
		igMainFolderFound = true;
		//Get the portlet folder
		DLFolder igPortletFolder = DLFolderLocalServiceUtil.getFolder(repositoryId,igMainFolderId,IMAGEGALLERY_PORTLETFOLDER);
		igPortletFolderId = igPortletFolder.getFolderId();
		igPortletFolderFound = true;
	} catch (Exception ex) {
	}

	ServiceContext serviceContext= ServiceContextFactory.getInstance( DLFolder.class.getName(), request);
	//Damos permisos al archivo para usuarios de comunidad.
	serviceContext.setAddGroupPermissions(true);
	serviceContext.setAddGuestPermissions(true);

	//Create main folder if not exist
	if(!igMainFolderFound) {
		Folder newImageMainFolder=DLAppLocalServiceUtil.addFolder(userId, repositoryId, 0, IMAGEGALLERY_MAINFOLDER, IMAGEGALLERY_MAINFOLDER_DESCRIPTION, serviceContext);
		igMainFolderId = newImageMainFolder.getFolderId();
		igMainFolderFound = true;
	}
	//Create portlet folder if not exist
	if(igMainFolderFound && !igPortletFolderFound){
		Folder newImagePortletFolder = DLAppLocalServiceUtil.addFolder(userId, repositoryId, igMainFolderId, IMAGEGALLERY_PORTLETFOLDER, IMAGEGALLERY_PORTLETFOLDER_DESCRIPTION, serviceContext);	    	
		igPortletFolderFound = true;
		igPortletFolderId = newImagePortletFolder.getFolderId();
	}
	//Create this record folder
	if(igPortletFolderFound){
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
		Date date = new Date();
		String igRecordFolderName=dateFormat.format(date)+SEPARATOR+userId;
		Folder newImageRecordFolder = DLAppLocalServiceUtil.addFolder(userId,repositoryId, igPortletFolderId,igRecordFolderName, igRecordFolderName, serviceContext);
		igRecordFolderId = newImageRecordFolder.getFolderId();
	}
	return igRecordFolderId;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:48,代码来源:modulePortlet.java

示例3: createOrganisationLogoFolder

import com.liferay.portal.service.ServiceContext; //导入方法依赖的package包/类
public static void createOrganisationLogoFolder(long groupId, long userId) throws PortalException, SystemException {
	final ServiceContext ctx = new ServiceContext();
	ctx.setUserId(userId);
	ctx.setScopeGroupId(groupId);
	ctx.setAddGroupPermissions(true);
	ctx.setAddGuestPermissions(true);
	// ctx.setWorkflowAction(WorkflowConstants.ACTION_PUBLISH);

	String orgFolder = getConfigValue(E_ConfigKey.ORGANISATION_LOGO_FOLDER);
	
	Folder parent = null;
	try {
		parent = DLAppServiceUtil.getFolder(groupId, 0,
		        orgFolder);
	} catch (final Throwable t) {
	}

	if (parent == null) {
		parent = DLAppServiceUtil.addFolder(groupId, 0,
		        orgFolder, "", ctx);
		m_objLog.info("Folder "
		        + orgFolder
		        + " created ....");
	} else {
		m_objLog.info("Folder "
		        + orgFolder
		        + " already existing ....");
	}

	final String[] actionids = new String[2];
	final Role guestRole = RoleLocalServiceUtil.getRole(
	        PortalUtil.getDefaultCompanyId(), RoleConstants.GUEST);
	actionids[0] = ActionKeys.VIEW;
	actionids[1] = ActionKeys.ACCESS;
	// actionids[2] = ActionKeys.ADD_FILE;

	ResourcePermissionServiceUtil.setIndividualResourcePermissions(
	        parent.getGroupId(), parent.getCompanyId(),
	        DLFolder.class.getName(), parent.getFolderId() + "",
	        guestRole.getRoleId(), actionids);
	
}
 
开发者ID:fraunhoferfokus,项目名称:particity,代码行数:43,代码来源:CustomPortalServiceHandler.java

示例4: createServiceContext

import com.liferay.portal.service.ServiceContext; //导入方法依赖的package包/类
/**
 * Create a serviceContext with given arguments
 * @param request
 * @param className
 * @param userId
 * @param groupId
 * @return
 * @throws PortalException
 * @throws SystemException
 */
private ServiceContext createServiceContext(ActionRequest request, String className, Long userId, Long groupId) throws PortalException, SystemException{
	ServiceContext serviceContext = ServiceContextFactory.getInstance(className, request);
       serviceContext.setAddGroupPermissions(true);
       serviceContext.setAddGuestPermissions(true);
       serviceContext.setUserId(userId);
       serviceContext.setScopeGroupId(groupId);
       return serviceContext;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:19,代码来源:moduleUpload.java


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