/** * Get the #WikittyUser that is logged in. A #SecurityException might be * thrown at runtime if the #WikittyUser session timed out. * @return the logged in #WikittyUser */ public WikittyUser getLoggedInUser() { long start = TimeLog.getTime(); String userId = WikittySecurityUtil.getUserForToken(wikittyService, securityToken); WikittyUser user = restore(WikittyUser.class, userId); timeLog.log(start, "getLoggedInUser"); return user; }
/** * Check that the logged in user is in a group. A #SecurityException might * be thrown at runtime if the #WikittyUser session timed out. * @param groupName the name of the group to check * @return true is the logged in user is in the group */ public boolean isMember(String groupName) { long start = TimeLog.getTime(); boolean result = false; WikittyUser user = getLoggedInUser(); //Find the group from its name Search search = Search.query() .eq(Element.ELT_EXTENSION, WikittyGroup.EXT_WIKITTYGROUP) .eq(WikittyGroup.FQ_FIELD_WIKITTYGROUP_NAME, groupName); Criteria criteria = search.criteria(); Wikitty group = findByCriteria(criteria); if (group != null && user != null) { result = WikittySecurityUtil.isMember(wikittyService, securityToken, user.getWikittyId(), group.getWikittyId()); } timeLog.log(start, "isMember"); return result; }
if (WikittySecurityUtil.isOutdated(config, getDelegate(), tokenId)) { getDelegate().delete(tokenId, Arrays.asList(tokenId)); tokenId = null;
/** * Check that the logged in user is in a group. A #SecurityException might * be thrown at runtime if the #WikittyUser session timed out. * @param groupName the name of the group to check * @return true is the logged in user is in the group */ public boolean isMember(String groupName) { long start = TimeLog.getTime(); boolean result = false; WikittyUser user = getLoggedInUser(); //Find the group from its name WikittyQuery criteria = new WikittyQueryMaker().and() .exteq(WikittyGroup.EXT_WIKITTYGROUP) .eq(WikittyGroup.FQ_FIELD_WIKITTYGROUP_NAME, groupName) .end(); Wikitty group = findByQuery(Wikitty.class, criteria); if (group != null && user != null) { result = WikittySecurityUtil.isMember(wikittyService, securityToken, user.getWikittyId(), group.getWikittyId()); } timeLog.log(start, "isMember"); return result; }
/** * Get the #WikittyUser that is logged in. A #SecurityException might be * thrown at runtime if the #WikittyUser session timed out. * @return the logged in #WikittyUser */ public WikittyUser getLoggedInUser() { long start = TimeLog.getTime(); String userId = WikittySecurityUtil.getUserForToken(wikittyService, securityToken); WikittyUser user = restore(WikittyUser.class, userId); timeLog.log(start, "getLoggedInUser"); return user; }