@Override protected User convert( String username ) throws ConversionException { return userAccessor.getUser( username ); } }
protected Calendar getBlogPostPublishedDate( int yearPublished, int monthPublished, int dayPublished) { Calendar publishedDate = Calendar.getInstance( userAccessor.getConfluenceUserPreferences( AuthenticatedUserThreadLocal.getUser() ).getTimeZone().getWrappedTimeZone() ); publishedDate.set(yearPublished, monthPublished - 1, dayPublished); return publishedDate; }
public UserLink(String username, I18NBean i18n) { this.username = username; this.userAccessor = ((UserAccessor) ContainerManager.getComponent("userAccessor")); this.user = userAccessor.getUserByName(username); this.i18n = i18n; }
public boolean authenticate(String username, String password) { final User user = userAccessor.getUser(username); return user != null && userAccessor.authenticate(user.getName(), password); }
private List<String> getUserNamesByGroup(String groupName) { Pager<String> usernames = null; final Group group = userAccessor.getGroup(groupName); if (group != null) { usernames = userAccessor.getMemberNames(group); } return usernames == null ? Collections.emptyList() : PagerUtils.toList(usernames); }
public static boolean isSuperUser(UserAccessor userAccessor, User user) { return user != null && userAccessor.hasMembership(UserAccessor.GROUP_CONFLUENCE_ADMINS, user.getName()) && !userAccessor.getPropertySet(user).getBoolean(UserPreferencesKeys.PROPERTY_USER_DEACTIVATED); } }
@Override public ImagePlaceholder getImagePlaceholder(Map<String, String> params, ConversionContext ctx) { String url = null; if (params.containsKey(PARAM_USER)) { final ConfluenceUser user = userAccessor.getUserByName(params.get(PARAM_USER)); final ProfilePictureInfo picture = userAccessor.getUserProfilePicture(user); url = (picture == null) ? null : picture.getUriReference(); } return new DefaultImagePlaceholder(url, false, new ImageDimensions(48, 48)); }
private boolean isValidAssigneeList() { if (StringUtils.isEmpty(assignees)) { return true; } boolean valid = true; String[] assigneeList = assignees.split(","); for (String anAssigneeList : assigneeList) { String assignee = anAssigneeList.trim(); if (getUserAccessor().getUserByName(assignee) == null && getUserAccessor().getGroup(assignee) == null) { errors.add(getText("invalid.assignee", new String[]{assignee})); valid = false; } } return valid; } }
Group confAdminGroup = userAccessor.getGroup(StudioGroups.CONF_ADMINS); List<String> confAdmins = userAccessor.getMemberNamesAsList(confAdminGroup); String sysadminUsername = themeProperties.getSystemAdministrator(); confAdmins = userAccessor.getMemberNamesAsList(confAdminGroup); attempts++;
public UserStorage( User user ) { super( BoxType.Virtual ); this.user = user; propertySet = getUserAccessor().getPropertySet( user ); }
@Override public void validate() { try { final Collection<String> encodedInvalidGroupNames = getBlackListEntriesCollection().stream() .filter(name -> !StringUtils.equals(UserList.ALL_GROUP_NAME, name) && null == userAccessor.getGroup(name)) .map(GeneralUtil::htmlEncode) .collect(Collectors.toSet()); final String joinedEncodedInvalidGroupNames = on(", ").join(encodedInvalidGroupNames); if (!encodedInvalidGroupNames.isEmpty()) { addActionError(getText("userlister.configure.invalid.group.names"), joinedEncodedInvalidGroupNames); } } catch (final IOException ioe) { logger.error("Unable to perform action validation", ioe); addActionError(getText("userlister.configure.ioexception")); } }
public void clearDiscovery(String featureKey) { final Plugin hipChatIntegration = pluginAccessor.getPlugin(HC_INTEGRATION_KEY); final ConfluenceUser remoteUser = userAccessor.getUserByKey(userManager.getRemoteUserKey()); discoveryService.forPlugin(hipChatIntegration).markUndiscovered(remoteUser, featureKey); } }
@Override public String execute(Map<String, String> params, String body, ConversionContext ctx) throws MacroExecutionException { String url; if (params.containsKey(PARAM_USER)) { final ConfluenceUser user = userAccessor.getUserByName(params.get(PARAM_USER)); final ProfilePictureInfo picture = userAccessor.getUserProfilePicture(user); url = (picture == null) ? null : picture.getUriReference(); } else { throw new MacroExecutionException("No user parameter specified"); } String username = HtmlUtils.htmlEscape(params.get(PARAM_USER)); return format("<a class=\"userLogoLink\" data-username=\"%s\" href=\"%s\" title=\"\">" + "<img class=\"userLogo logo\" src=\"%s\" alt=\"User icon: %s\" title=\"\">" + "</a>", username, settingsManager.getGlobalSettings().getBaseUrl() + "/display/~" + username, url, username); }
private DataHandler createAvatarDataHandler(User user) throws MessagingException, IOException { PropertySet propertySet = userAccessor.getPropertySet(user); if (propertySet == null) return createWebResourceDataHandler(ProfilePictureInfo.DEFAULT_PROFILE_PATH); String profilePicture = propertySet.getString(UserPreferencesKeys.PROPERTY_USER_PROFILE_PICTURE); if (profilePicture == null) { return createWebResourceDataHandler(ProfilePictureInfo.DEFAULT_PROFILE_PATH); } if (profilePicture.startsWith(UserAccessor.PROFILE_PICTURE_BUILTIN_PATH)) { return createWebResourceDataHandler(profilePicture); } PersonalInformation personalInformation = personalInformationManager.getPersonalInformation(user); if (personalInformation == null) return createWebResourceDataHandler(ProfilePictureInfo.DEFAULT_PROFILE_PATH); Attachment a = attachmentManager.getAttachment(personalInformation, profilePicture); if (a != null) { return new DataHandler(new ProfileImageDataSource(new ByteArrayDataSource(a.getContentsAsStream(), a.getContentType()))); } return null; }
final ConfluenceUser recipientUser = userAccessor.getUserByKey(recipient.getUserKey());
public User getUser() { if (user == null) user = userManager.getUser(userName); return user; }
/** * TODO: replace this method by using another one in core: * com.atlassian.confluence.content.render.xhtml.DefaultStorageFormatService#createStorageFormatForDate * The method is from CONF v5.6 onwards and that using the method will break backwards compatibility of meeting notes * * @return string that is represented a time tag */ public String createStorageFormatForToday() { ConfluenceUserPreferences preferences = userAccessor.getConfluenceUserPreferences(AuthenticatedUserThreadLocal.get()); DateFormatter dateFormatter = preferences.getDateFormatter(formatSettingsManager, localeManager); return String.format("<time datetime=\"%s\"></time>", dateFormatter.formatGivenString(STORAGE_DATE_FORMAT, new Date())); } }
Predicate<String> canCommentOn(final AbstractPage abstractPage) { return username -> permissionManager.hasCreatePermission(userAccessor.getUserByName(username), abstractPage, Comment.class); }
final ContentEntityObject content = contentEntityManager.getById(id); final ConfluenceUser user = userAccessor.getUserByKey(recipient);
@Override protected User convert( UserProfile userProfile ) throws ConversionException { return userAccessor.getUser( userProfile.getUsername() ); } }