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


Java GroupLocalServiceUtil.hasUserGroup方法代码示例

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


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

示例1: addStudentToCourse

import com.liferay.portal.service.GroupLocalServiceUtil; //导入方法依赖的package包/类
@JSONWebService
public void addStudentToCourse(long courseId,String login) throws PortalException, SystemException
{
	ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
	Course course=courseLocalService.fetchCourse(courseId);
	User user = userLocalService.fetchUserByScreenName(serviceContext.getCompanyId(), login);
	if(course!=null && user!=null){
		if(getPermissionChecker().hasPermission(course.getGroupId(),  Course.class.getName(),courseId,"ASSIGN_MEMBERS")&& ! course.isClosed())
		{
			
			if (!GroupLocalServiceUtil.hasUserGroup(user.getUserId(), course.getGroupCreatedId())) {
				GroupLocalServiceUtil.addUserGroups(user.getUserId(), new long[] { course.getGroupCreatedId() });
				//sendEmail(user,course);
			}
			
			UserGroupRoleLocalServiceUtil.addUserGroupRoles(new long[] { user.getUserId() },
					course.getGroupCreatedId(), RoleLocalServiceUtil.getRole(serviceContext.getCompanyId(), RoleConstants.SITE_MEMBER).getRoleId());

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

示例2: editUserInscriptionDates

import com.liferay.portal.service.GroupLocalServiceUtil; //导入方法依赖的package包/类
public void editUserInscriptionDates(long courseId,long userId,Date allowStartDate,Date allowFinishDate) throws 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 = userLocalService.getUser(userId);
		if (!GroupLocalServiceUtil.hasUserGroup(user.getUserId(), course.getGroupCreatedId())) {
			return;
		}		
		CourseResult courseResult=courseResultLocalService.getCourseResultByCourseAndUser(courseId, user.getUserId());
		if(courseResult==null)
		{
			courseResultLocalService.create(courseId, user.getUserId(), allowStartDate, allowFinishDate);
		}
		else
		{
			courseResult.setAllowStartDate(allowStartDate);
			courseResult.setAllowFinishDate(allowFinishDate);
			courseResultLocalService.updateCourseResult(courseResult);
		}
		//auditing
		AuditingLogFactory.audit(course.getCompanyId(), course.getGroupId(), Course.class.getName(), course.getCourseId(), serviceContext.getUserId(), AuditConstants.UPDATE, null);		 
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:26,代码来源:CourseServiceImpl.java

示例3: addTeacherToCourse

import com.liferay.portal.service.GroupLocalServiceUtil; //导入方法依赖的package包/类
@JSONWebService
public void addTeacherToCourse(long courseId,String login) throws 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);
		if (!GroupLocalServiceUtil.hasUserGroup(user.getUserId(), course.getGroupCreatedId())) {
			GroupLocalServiceUtil.addUserGroups(user.getUserId(), new long[] { course.getGroupCreatedId() });
			//sendEmail(user,course);
		}
		UserGroupRoleLocalServiceUtil.addUserGroupRoles(new long[] { user.getUserId() },
				course.getGroupCreatedId(), LmsPrefsLocalServiceUtil.getLmsPrefs(serviceContext.getCompanyId()).getTeacherRole());

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

示例4: addEditorToCourse

import com.liferay.portal.service.GroupLocalServiceUtil; //导入方法依赖的package包/类
@JSONWebService
public void addEditorToCourse(long courseId,String login) throws 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);
		if (!GroupLocalServiceUtil.hasUserGroup(user.getUserId(), course.getGroupCreatedId())) {
			GroupLocalServiceUtil.addUserGroups(user.getUserId(), new long[] { course.getGroupCreatedId() });
			//sendEmail(user,course);
		}
		UserGroupRoleLocalServiceUtil.addUserGroupRoles(new long[] { user.getUserId() },
				course.getGroupCreatedId(), LmsPrefsLocalServiceUtil.getLmsPrefs(serviceContext.getCompanyId()).getEditorRole());

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

示例5: editUserInscriptionDates

import com.liferay.portal.service.GroupLocalServiceUtil; //导入方法依赖的package包/类
public void editUserInscriptionDates(long courseId,long userId,Date allowStartDate,Date allowFinishDate) throws PortalException, SystemException
{
	ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
	Course course=courseLocalService.getCourse(courseId);
	
		User user = userLocalService.getUser(userId);
		if (!GroupLocalServiceUtil.hasUserGroup(user.getUserId(), course.getGroupCreatedId())) {
			return;
		}		
		CourseResult courseResult=courseResultLocalService.getCourseResultByCourseAndUser(courseId, user.getUserId());
		if(courseResult==null)
		{
			courseResultLocalService.create(courseId, user.getUserId(), allowStartDate, allowFinishDate);
		}
		else
		{
			courseResult.setAllowStartDate(allowStartDate);
			courseResult.setAllowFinishDate(allowFinishDate);
			courseResultLocalService.updateCourseResult(courseResult);
		}
		//auditing
		AuditingLogFactory.audit(course.getCompanyId(), course.getGroupId(), Course.class.getName(), course.getCourseId(), serviceContext.getUserId(), AuditConstants.UPDATE, null);		 
	
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:25,代码来源:CourseLocalServiceImpl.java

示例6: addUserRole

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

		long courseId = ParamUtil.getLong(actionRequest, "courseId", 0);
		long roleId = ParamUtil.getLong(actionRequest, "roleId", 0);
//		long userId = ParamUtil.getLong(actionRequest, "userId", 0);
		// Multiusuario
		long[] to = ParamUtil.getLongValues(actionRequest, "to");
//		long[] userIds=new long[1];
//		userIds[0]=ParamUtil.getLong(actionRequest, "userId");
		Course course = CourseLocalServiceUtil.getCourse(courseId);
		
		LmsPrefs prefs=LmsPrefsLocalServiceUtil.getLmsPrefs(course.getCompanyId());
		Long teacherRoleId=RoleLocalServiceUtil.getRole(prefs.getTeacherRole()).getRoleId();
		Long editorRoleId=RoleLocalServiceUtil.getRole(prefs.getEditorRole()).getRoleId();
		
		for (long userId : to) {
			if (!GroupLocalServiceUtil.hasUserGroup(userId, course.getGroupCreatedId())) {
				GroupLocalServiceUtil.addUserGroups(userId,	new long[] { course.getGroupCreatedId() });
			//The application only send one mail at listener
			//User user = UserLocalServiceUtil.getUser(userId);
			//sendEmail(user, course);
			}
			UserGroupRoleLocalServiceUtil.addUserGroupRoles(new long[] { userId }, course.getGroupCreatedId(), roleId);
			
			if(roleId == teacherRoleId){
				AuditingLogFactory.audit(course.getCompanyId(), course.getGroupCreatedId(), Course.class.getName(), 
						course.getCourseId(),userId, AuditConstants.REGISTER, "COURSE_TUTOR_ADD");
			}
			if(roleId == editorRoleId){
				AuditingLogFactory.audit(course.getCompanyId(), course.getGroupCreatedId(), Course.class.getName(), 
						course.getCourseId(),userId, AuditConstants.REGISTER, "COURSE_EDITOR_ADD");
			}
		}	
		
		actionResponse.setRenderParameters(actionRequest.getParameterMap());
	}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:37,代码来源:BaseCourseAdminPortlet.java

示例7: addStudentToCourseWithDates

import com.liferay.portal.service.GroupLocalServiceUtil; //导入方法依赖的package包/类
@JSONWebService
public void addStudentToCourseWithDates(long courseId,String login,Date allowStartDate,Date allowFinishDate) throws 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 = userLocalService.getUserByScreenName(serviceContext.getCompanyId(), login);
		if (!GroupLocalServiceUtil.hasUserGroup(user.getUserId(), course.getGroupCreatedId())) {
			GroupLocalServiceUtil.addUserGroups(user.getUserId(), new long[] { course.getGroupCreatedId() });
			//sendEmail(user,course);
		}
		
		UserGroupRoleLocalServiceUtil.addUserGroupRoles(new long[] { user.getUserId() },
				course.getGroupCreatedId(), RoleLocalServiceUtil.getRole(serviceContext.getCompanyId(), RoleConstants.SITE_MEMBER).getRoleId());
		CourseResult courseResult=courseResultLocalService.getCourseResultByCourseAndUser(courseId, user.getUserId());
		if(courseResult==null)
		{
			courseResultLocalService.create(courseId, user.getUserId(), allowStartDate, allowFinishDate);
		}
		else
		{
			courseResult.setAllowStartDate(allowStartDate);
			courseResult.setAllowFinishDate(allowFinishDate);
			courseResultLocalService.updateCourseResult(courseResult);
		}
		//auditing
		AuditingLogFactory.audit(course.getCompanyId(), course.getGroupId(), Course.class.getName(), course.getCourseId(), serviceContext.getUserId(), AuditConstants.REGISTER, null);		 
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:31,代码来源:CourseServiceImpl.java

示例8: addStudentToCourseWithDates

import com.liferay.portal.service.GroupLocalServiceUtil; //导入方法依赖的package包/类
public void addStudentToCourseWithDates(long courseId,long userId,Date allowStartDate,Date allowFinishDate) throws PortalException, SystemException
{
	Course course=courseLocalService.getCourse(courseId);
	;
		User user = userLocalService.fetchUser(userId);
		if (!GroupLocalServiceUtil.hasUserGroup(user.getUserId(), course.getGroupCreatedId())) {
			GroupLocalServiceUtil.addUserGroups(user.getUserId(), new long[] { course.getGroupCreatedId() });
			//sendEmail(user,course);
		}
		
		UserGroupRoleLocalServiceUtil.addUserGroupRoles(new long[] { user.getUserId() },
				course.getGroupCreatedId(), RoleLocalServiceUtil.getRole(user.getCompanyId(), RoleConstants.SITE_MEMBER).getRoleId());
		CourseResult courseResult=courseResultLocalService.getCourseResultByCourseAndUser(courseId, user.getUserId());
		if(courseResult==null)
		{
			courseResultLocalService.create(courseId, user.getUserId(), allowStartDate, allowFinishDate);
		}
		else
		{
			courseResult.setAllowStartDate(allowStartDate);
			courseResult.setAllowFinishDate(allowFinishDate);
			courseResultLocalService.updateCourseResult(courseResult);
		}
		//auditing
		AuditingLogFactory.audit(course.getCompanyId(), course.getGroupId(), Course.class.getName(), course.getCourseId(), userId, AuditConstants.REGISTER, null);		 
	
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:28,代码来源:CourseLocalServiceImpl.java

示例9: usuarioPodeSairDaComunidade

import com.liferay.portal.service.GroupLocalServiceUtil; //导入方法依赖的package包/类
private boolean usuarioPodeSairDaComunidade(Group comunidade, User usuario) throws SystemException {
	boolean comunidadeDiferenteDaGuest = !comunidade.isGuest();
	boolean usuarioEMembroDaComunidade = GroupLocalServiceUtil.hasUserGroup(usuario.getUserId(), comunidade.getGroupId());

	if (usuarioEMembroDaComunidade && comunidadeDiferenteDaGuest && comunidade.isRegularSite()) {
		return true;
	} else {
		return false;
	}
}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:11,代码来源:InscricaoComunidade.java

示例10: usuarioPodeAssinarAComunidade

import com.liferay.portal.service.GroupLocalServiceUtil; //导入方法依赖的package包/类
private boolean usuarioPodeAssinarAComunidade(Group comunidade, User usuario) throws SystemException {
	boolean usuarioNaoEstaNaComunidade = !GroupLocalServiceUtil.hasUserGroup(usuario.getUserId(), comunidade.getGroupId());
	boolean comunidadeAberta = comunidade.getType() == GroupConstants.TYPE_SITE_OPEN;

	if (usuarioNaoEstaNaComunidade && comunidadeAberta && comunidade.isRegularSite()) {
		return true;
	} else {
		return false;
	}
}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:11,代码来源:InscricaoComunidade.java


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