• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java User类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getUser

import org.sakaiproject.user.api.User; //导入依赖的package包/类
public org.sakaiproject.kaltura.logic.User getUser(String userId) {
    org.sakaiproject.kaltura.logic.User user = null;
    if (userId != null) {
        User u = null;
        try {
            u = userDirectoryService.getUserByEid(userId);
        } catch (UserNotDefinedException e) {
            try {
                u = userDirectoryService.getUser(userId);
            } catch (UserNotDefinedException e1) {
                log.warn("Cannot get user for id: " + userId);
            }
        }
        if (u != null) {
            user = new org.sakaiproject.kaltura.logic.User(u.getId(),
                    u.getEid(), u.getDisplayName(), u.getSortName(), u.getEmail());
            user.fname = u.getFirstName();
            user.lname = u.getLastName();
        }
    }
    return user;
}
 
开发者ID:ITYug,项目名称:kaltura-ce-sakai-extension,代码行数:23,代码来源:SakaiExternalLogicImpl.java


示例2: isUserStudent

import org.sakaiproject.user.api.User; //导入依赖的package包/类
/**
* Check if the specified user has the student role on the specified site.
* @param siteId Site ID
* @param userId User ID
* @return true if user has student role on the site.
*/
    public boolean isUserStudent(String  siteId, String userId){
        boolean isStudent=false;
        try{
                    Set<String> studentIds = siteService.getSite(siteId).getUsersIsAllowed("section.role.student");
                    List<User> activeUsers = userDirectoryService.getUsers(studentIds);
                    for (int i = 0; i < activeUsers.size(); i++) {
                        User user = activeUsers.get(i);
                        if(userId.equals(user.getId())){
                            return true;
                        }
                    }
            }catch(Exception e){
                log.info("(isStudentUser)"+e);
            }
        return isStudent;
    }
 
开发者ID:sakaicontrib,项目名称:turnitin,代码行数:23,代码来源:TurnitinReviewServiceImpl.java


示例3: getProfileImage

import org.sakaiproject.user.api.User; //导入依赖的package包/类
@EntityCustomAction(action = "details", viewKey = EntityView.VIEW_LIST)
public Object getProfileImage(OutputStream out, EntityView view, Map<String,Object> params) {

    JSONObject result = new JSONObject();

    result.put("status", "ERROR");

    User currentUser = UserDirectoryService.getCurrentUser();
    String currentUserId = currentUser.getId();

    if (currentUserId == null) {
        log.warn("Access denied");
        return result.toJSONString();
    }

    String imageUrl = imageLogic.getProfileImageEntityUrl(currentUserId, ProfileConstants.PROFILE_IMAGE_MAIN);

    result.put("url", imageUrl);
    result.put("isDefault", imageLogic.profileImageIsDefault(currentUserId));
    result.put("csrf_token", sessionManager.getCurrentSession().getAttribute("sakai.csrf.token"));
    result.put("status", "SUCCESS");

    return result.toJSONString();
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:25,代码来源:ProfileImageEntityProvider.java


示例4: getImpersonatorDisplayId

import org.sakaiproject.user.api.User; //导入依赖的package包/类
/**
 * Checks if current user is being impersonated (via become user/sutool) and returns displayId of
 * the impersonator. Adapted from SkinnableLogin's isImpersonating()
 * @return displayId of impersonator, or empty string if not being impersonated
 */
private String getImpersonatorDisplayId()
{
	Session currentSession = SessionManager.getCurrentSession();
	UsageSession originalSession = (UsageSession) currentSession.getAttribute(UsageSessionService.USAGE_SESSION_KEY);
	
	if (originalSession != null)
	{
		String originalUserId = originalSession.getUserId();
		if (!StringUtils.equals(currentSession.getUserId(), originalUserId))
		{
			try
			{
				User originalUser = UserDirectoryService.getUser(originalUserId);
				return originalUser.getDisplayId();
			}
			catch (UserNotDefinedException e)
			{
				log.debug("Unable to retrieve user for id: {}", originalUserId);
			}
		}
	}
	
	return "";
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:30,代码来源:SkinnableCharonPortal.java


示例5: getUserLastName

import org.sakaiproject.user.api.User; //导入依赖的package包/类
/**
 * Get user last Name. If turnitin.generate.last.name is set to true last
 * name is anonamised
 * 
 * @param user
 * @return
 */
private String getUserLastName(User user) {
	String uln = user.getLastName().trim();
	if (uln == null || uln.equals("")) {
		boolean genLN = serverConfigurationService.getBoolean("turnitin.generate.last.name", false);
		if (genLN) {
			String eid = user.getEid();
			if (eid != null && eid.length() > 0) {
				uln = eid.substring(0, 1);
			} else {
				uln = "X";
			}
		}
	}
	return uln;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:23,代码来源:TurnitinReviewServiceImpl.java


示例6: getUserDisplayName

import org.sakaiproject.user.api.User; //导入依赖的package包/类
/**
 * Gets the display name for a given user
 * <p/>
 * Differs from original above as that one uses the session to get the displayname hence you must know this in advance or be logged in to the web services
 * with that user. This uses a userid as well so we could be logged in as admin and retrieve the display name for any user.
 *
 * @param sessionid the id of a valid session
 * @param userid    the login username (ie jsmith26) of the user you want the display name for
 * @return the display name for the user
 * @throws RuntimeException
 */
@WebMethod
@Path("/getUserDisplayName")
@Produces("text/plain")
@GET
public String getUserDisplayName(
        @WebParam(name = "sessionid", partName = "sessionid") @QueryParam("sessionid") String sessionid,
        @WebParam(name = "userid", partName = "userid") @QueryParam("userid") String userid) {
    Session session = establishSession(sessionid);
    try {
        User user = userDirectoryService.getUserByEid(userid);
        return user.getDisplayName();
    } catch (Exception e) {
        log.error("WS getUserDisplayName() failed for user: " + userid + " : " + e.getClass().getName() + " : " + e.getMessage());
        return "";
    }
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:28,代码来源:SakaiScript.java


示例7: postNotification

import org.sakaiproject.user.api.User; //导入依赖的package包/类
/**
 * Handles a request to create a new notification. Expects /notify/post/{userEId}
 *
 * @param view
 * @param params
 * @return
 */
@EntityCustomAction(action = "post", viewKey = EntityView.VIEW_NEW)
public void postNotification(EntityView view, Map<String, Object> params) {
    if (log.isDebugEnabled()) {
        log.debug("postNotification params: " + params);
    }
    if (!isEnabled()) {
        throw new IllegalStateException("Service is disabled. Check your configuration ("+NOTIFY_POST_ENABLED+" must be true)!");
    } else {
        isAuthorized(); // does check and throws exception if fails to pass

        String userEId = getUserEId(view);
        User user = getUserByEId(userEId);
        String notification = getNotification(params);

        emailNotification.addMessage(notification);
        Event event = eventTrackingService.newEvent("rest.notify.post", null, user.getId(), false, NotificationService.NOTI_OPTIONAL);
        eventTrackingService.post(event);
    }
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:27,代码来源:NotificationEntityProvider.java


示例8: getHeaders

import org.sakaiproject.user.api.User; //导入依赖的package包/类
@Override
protected List<String> getHeaders(Event event) 
{
	List<String> rv = super.getHeaders(event);

	// the Subject
	rv.add("Subject: " + getSubject(event));

	// from
	rv.add(getFrom(event));

	// to
	List toList = getRecipients(event);
	Iterator itr = toList.iterator();
	StringBuilder recips = new StringBuilder();
	while (itr.hasNext())
	{
		User usr = (User) itr.next();
		recips.append(usr.getEmail() + ", ");
	}
	rv.add("To: " + recips.toString());

	return rv;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:25,代码来源:DropboxNotification.java


示例9: getDisplayId

import org.sakaiproject.user.api.User; //导入依赖的package包/类
public String getDisplayId(User user) {
	String displayId = null;
	if (myProvider instanceof DisplayAdvisorUDP) {
		displayId = ((DisplayAdvisorUDP)myProvider).getDisplayId(user); 
		if (displayId != null) {
			return displayId;
		}
	}
	if (nextProvider instanceof DisplayAdvisorUDP) {
		displayId = ((DisplayAdvisorUDP)nextProvider).getDisplayId(user); 
		if (displayId != null) {
			return displayId;
		}
	}
	return null;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:17,代码来源:FilterUserDirectoryProvider.java


示例10: getAllPossbileCoordinatorsOnFastTrack

import org.sakaiproject.user.api.User; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
public List<SignupUser> getAllPossbileCoordinatorsOnFastTrack(SignupMeeting meeting) {
	List<SignupUser> coordinators = new ArrayList<SignupUser>();
	List<SignupSite> signupSites = meeting.getSignupSites();
	Set<String> userIdsHasPermissionToCreate = new HashSet<String>();
	if (signupSites != null) {
		for (SignupSite site: signupSites) {
			//Only thing we miss here is that the view permission is not checked. the Chance is very small.
			userIdsHasPermissionToCreate.addAll(getUserIdsHasPermissionToCreate(site));
		}
	}
	
	List<User> sakaiUsers = userDirectoryService.getUsers(userIdsHasPermissionToCreate);
	for (User user : sakaiUsers) {
		SignupUser signupUser = new SignupUser(user.getEid(), user.getId(), user.getFirstName(), user.getLastName(), 
				null, "", true);
 				coordinators.add(signupUser);	
 	}

	return coordinators;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:25,代码来源:SakaiFacadeImpl.java


示例11: getUserFirstName

import org.sakaiproject.user.api.User; //导入依赖的package包/类
/**
 * Gets a first name for a user or generates an initial from the eid
 * 
 * @param user
 *            a sakai user
 * @return the first name or at least an initial if possible, "X" if no fn
 *         can be made
 */
private String getUserFirstName(User user) {
	String ufn = user.getFirstName().trim();
	if (ufn == null || ufn.equals("")) {
		boolean genFN = (boolean) serverConfigurationService.getBoolean("turnitin.generate.first.name", true);
		if (genFN) {
			String eid = user.getEid();
			if (eid != null && eid.length() > 0) {
				ufn = eid.substring(0, 1);
			} else {
				ufn = "X";
			}
		}
	}
	return ufn;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:24,代码来源:TurnitinReviewServiceImpl.java


示例12: getActiveBannersJSON

import org.sakaiproject.user.api.User; //导入依赖的package包/类
private String getActiveBannersJSON() {
    JSONArray banners = new JSONArray();
    String serverId = ServerConfigurationService.getString("serverId", "localhost");

    User currentUser = UserDirectoryService.getCurrentUser();

    if (currentUser != null && currentUser.getId() != null && !"".equals(currentUser.getId())) {
        for (Banner banner : getBanners().getRelevantBanners(serverId, currentUser.getId())) {
            try {
                JSONObject bannerData = new JSONObject();
                bannerData.put("id", banner.getUuid());
                bannerData.put("message", banner.getMessage());
                bannerData.put("dismissible", banner.isDismissible());
                bannerData.put("dismissed", banner.isDismissed());
                bannerData.put("type", banner.getType());
                banners.add(bannerData);
            } catch (Exception e) {
                log.warn("Error processing banner: " + banner, e);
            }
        }
    }

    return banners.toJSONString();
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:25,代码来源:PASystemImpl.java


示例13: getUserMap

import org.sakaiproject.user.api.User; //导入依赖的package包/类
private Map<String, User> getUserMap(Set<Member> members) {

        Map<String, User> userMap = new HashMap<String, User>();

        Set<String> userIds = new HashSet<String>();

        // Build a map of userId to role
        for (Member member : members) {
            if (member.isActive()) {
				userIds.add(member.getUserId());
	        }
        }

        // Get the user objects
        for (User user : userDirectoryService.getUsers(userIds)) {
            userMap.put(user.getId(), user);
        }

        return userMap;
    }
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:21,代码来源:SakaiProxyImpl.java


示例14: getUserDisplayName

import org.sakaiproject.user.api.User; //导入依赖的package包/类
public String getUserDisplayName(String userId) {
   try {
      User user = userDirectoryService.getUser(userId);
      return user.getDisplayName();
   } catch (UserNotDefinedException ex) {
      log.error("Could not get user from userId: " + userId, ex);
   }
   if (userId.startsWith(ANON_USER_PREFIX)) {
      return "Anonymous User";
   }
   return "----------";
}
 
开发者ID:sakaicontrib,项目名称:blogwow,代码行数:13,代码来源:ExternalLogicImpl.java


示例15: getCurrentUserDisplayName

import org.sakaiproject.user.api.User; //导入依赖的package包/类
public String getCurrentUserDisplayName(){
User user = userDirectoryService.getCurrentUser();
if(user != null){
 return user.getDisplayName();
}

return "";
}
 
开发者ID:sakaicontrib,项目名称:blogwow,代码行数:9,代码来源:ExternalLogicImpl.java


示例16: validatePassword

import org.sakaiproject.user.api.User; //导入依赖的package包/类
@EntityCustomAction(action="validatePassword", viewKey=EntityView.VIEW_NEW)
public ActionReturn validatePassword(EntityView view, Map<String, Object> params) {
    PasswordRating rating = PasswordRating.PASSED_DEFAULT;
    if (!params.containsKey("password")) {
        throw new IllegalArgumentException("Must include a 'password' to validate");
    }
    String password = (String) params.get("password");
    User user = null;
    if (params.containsKey("username")) {
        String username = (String) params.get("username");
        user = new EntityUser(username, null, null, null, username, null, password, null);
    }
    rating = userDirectoryService.validatePassword(password, user);
    return new ActionReturn(rating.name());
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:16,代码来源:UserEntityProvider.java


示例17: testSearchUsers

import org.sakaiproject.user.api.User; //导入依赖的package包/类
@Test
public void testSearchUsers() {
	List<User> users = dbUserService.searchUsers("Joe", 1, 1);
	if (users == null) {
		log.error("empty list from search");
		Assert.fail();
	} else if (users.size() == 0 || users.size() > 1) {
		log.error("list of size 1 expected list contained: " + users.size());
		Assert.fail();
	}
	}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:12,代码来源:GetUsersByEidTest.java


示例18: getDisplayName

import org.sakaiproject.user.api.User; //导入依赖的package包/类
public String getDisplayName(User user) {
	if (!UNADVISED_USER_EID.equals(user.getEid())) {
		return user.getFirstName() + " " + user.getLastName() + DISPLAY_ADVISED_SUFFIX;
	} else {
		return null;
	}
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:8,代码来源:ContextualDisplayServiceTest.java


示例19: getInstitutionalNumericIdIgnoringCandidatePermissions

import org.sakaiproject.user.api.User; //导入依赖的package包/类
@Override
public Optional<String> getInstitutionalNumericIdIgnoringCandidatePermissions(User candidate, Site site)
{
	for (CandidateDetailProvider provider : getProviders())
	{
		String studentNumber = provider.getInstitutionalNumericIdIgnoringCandidatePermissions(candidate, site).orElse("");
		if (StringUtils.isNotBlank(studentNumber))
		{
			return Optional.of(studentNumber);
		}
	}
	
	return Optional.empty();
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:15,代码来源:ChainedDetailProvider.java


示例20: generateEvents

import org.sakaiproject.user.api.User; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public List<VEvent> generateEvents(User user, SignupCalendarHelper calendarHelper) {
    List<VEvent> events = new ArrayList<VEvent>();
    for (SignupTimeslot timeslot : this.getRemoved()) {
        final VEvent event = timeslot.getVevent();
        if (event != null) {
            calendarHelper.cancelVEvent(event);
            events.add(event);
        }
    }
    return events;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:15,代码来源:CancellationEmail.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DefaultMatchEngine类代码示例发布时间:2022-05-22
下一篇:
Java RenderWither类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap