Interface AvatarService
- All Known Implementing Classes:
AvatarServiceImpl
Avatars
.- Since:
- v4.3
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canSetCustomUserAvatar
(ApplicationUser remoteUser, ApplicationUser user) Returns a boolean indicating whether the calling user can edit the custom user avatar for the user with the given username.boolean
canSetCustomUserAvatar
(ApplicationUser remoteUser, String username) Deprecated.getAvatar
(ApplicationUser remoteUser, ApplicationUser avatarUser) Returns the Avatar for the given user, if configured.getAvatar
(ApplicationUser remoteUser, String username) Deprecated.getAvatarAbsoluteURL
(ApplicationUser remoteUser, ApplicationUser avatarUser, Avatar.Size size) This is the same asgetAvatarURL(ApplicationUser, String, Avatar.Size)
but returns an absolute URL.getAvatarAbsoluteURL
(ApplicationUser remoteUser, String username, Avatar.Size size) Deprecated.getAvatarTagged
(ApplicationUser remoteUser, ApplicationUser avatarUser) getAvatarURL
(ApplicationUser remoteUser, ApplicationUser avatarUser) Returns the URL for the avatar of the user having the given username for displaying on a page that should be shown for the passed in remoteUser.getAvatarURL
(ApplicationUser remoteUser, ApplicationUser avatarUser, Avatar.Size size) Returns the URL for the avatar of the user having the given username for displaying on a page that should be shown for the passed in remoteUser.getAvatarURL
(ApplicationUser remoteUser, String username) Deprecated.getAvatarURL
(ApplicationUser remoteUser, String username, Avatar.Size size) Deprecated.getAvatarUrlNoPermCheck
(ApplicationUser avatarUser, Avatar.Size size) This is the same asgetAvatarURL(ApplicationUser, String, Size)
but does no permission checking.getAvatarUrlNoPermCheck
(ApplicationUser applicationUser, Avatar avatar, Avatar.Size size) Deprecated.getAvatarUrlNoPermCheck
(String username, Avatar.Size size) Deprecated.getGravatarAvatarURL
(ApplicationUser avatarUser, Avatar.Size size) If Gravatar is enabled returns Gravatar url for given user at given size.getProjectAvatarAbsoluteURL
(Project project, Avatar.Size size) Returns the URL for the avatar of the given project.getProjectAvatarURL
(Project project, Avatar.Size size) Returns the URL for the avatar of the given project.Returns the URL for the default avatar of a project.Returns the URL for the default avatar of a project.boolean
hasCustomUserAvatar
(ApplicationUser remoteUser, ApplicationUser username) Returns true if the user has configured a custom avatar, false otherwise.boolean
hasCustomUserAvatar
(ApplicationUser remoteUser, String username) boolean
Deprecated.this is an avatar-provider plugin-implementation-specific concernboolean
isUsingExternalAvatar
(ApplicationUser remoteUser, ApplicationUser avatarUser) Check whether a user currently has an external avatar (for example, a Gravatar).void
setCustomUserAvatar
(ApplicationUser remoteUser, ApplicationUser user, Long avatarId) Sets a custom avatar for a given user.void
setCustomUserAvatar
(ApplicationUser remoteUser, String username, Long avatarId) Deprecated.
-
Method Details
-
getAvatar
Deprecated.UsegetAvatar(ApplicationUser, ApplicationUser)
. Since v6.0Returns the Avatar for the given user, if configured. If the user does not have a custom avatar, or if the calling user does not have permission to view the Avatar, this method returns the default avatar. If the user does not exist, this method returns the anonymous avatar.If this method would return the default user avatar but none is configured, or if this method would return the anonymous avatar but none is configured, this method returns null.
- Parameters:
remoteUser
- the User that wants to view an Avatarusername
- a String containing a username (may have been deleted)- Returns:
- an Avatar, or null
- Throws:
AvatarsDisabledException
- if avatars are disabled- Since:
- v4.3
-
getAvatar
Avatar getAvatar(ApplicationUser remoteUser, ApplicationUser avatarUser) throws AvatarsDisabledException Returns the Avatar for the given user, if configured. If the user does not have a custom avatar, or if the calling user does not have permission to view the Avatar, this method returns the default avatar. If the user does not exist, this method returns the anonymous avatar.If this method would return the default user avatar but none is configured, or if this method would return the anonymous avatar but none is configured, this method returns null.
- Parameters:
remoteUser
- the User that wants to view an AvataravatarUser
- the User that the avatar will be returned for (if null it will return a default avatar if it's set or null)- Returns:
- an Avatar, or null
- Throws:
AvatarsDisabledException
- if avatars are disabled- Since:
- v6.0
-
getAvatarURL
Deprecated.UsegetAvatarURL(ApplicationUser, ApplicationUser)
. Since v6.0Returns the URL for the avatar of the user having the given username for displaying on a page that should be shown for the passed in remoteUser. This method returns a URL for an avatar with the default size.If the user does not have a custom avatar, or if the calling user does not have permission to view the Avatar, this method returns the URL of the default avatar. If the user does not exist, this method returns the URL of the anonymous avatar.
- Parameters:
remoteUser
- a User object for the currently logged in userusername
- a String containing a username (may have been deleted)- Returns:
- a URL that can be used to display the avatar
- Throws:
AvatarsDisabledException
- if avatars are disabled- Since:
- v5.0.3
- See Also:
-
getAvatarURL
URI getAvatarURL(@Nullable ApplicationUser remoteUser, @Nullable ApplicationUser avatarUser) throws AvatarsDisabledException Returns the URL for the avatar of the user having the given username for displaying on a page that should be shown for the passed in remoteUser. This method returns a URL for an avatar with the default size.If the user does not have a custom avatar, or if the calling user does not have permission to view the Avatar, this method returns the URL of the default avatar. If the user does not exist, this method returns the URL of the anonymous avatar.
- Parameters:
remoteUser
- a User object for the currently logged in useravatarUser
- a User object to get the avatar for (if null, the default avatar is used)- Returns:
- a URL that can be used to display the avatar
- Throws:
AvatarsDisabledException
- if avatars are disabled- Since:
- v6.0
- See Also:
-
getAvatarURL
URI getAvatarURL(ApplicationUser remoteUser, String username, Avatar.Size size) throws AvatarsDisabledException Deprecated.UsegetAvatarURL(ApplicationUser, ApplicationUser, Size)
. Since v6.0Returns the URL for the avatar of the user having the given username for displaying on a page that should be shown for the passed in remoteUser.If the user does not have a custom avatar, or if the calling user does not have permission to view the Avatar, this method returns the URL of the default avatar. If the user does not exist, this method returns the URL of the anonymous avatar.
- Parameters:
remoteUser
- a User object for the currently logged in userusername
- a String containing a username (may have been deleted)size
- the size of the avatar to be displayed (if null, the default size is used)- Returns:
- a URL that can be used to display the avatar
- Throws:
AvatarsDisabledException
- if avatars are disabled- Since:
- v4.3
- See Also:
-
getAvatarURL
URI getAvatarURL(ApplicationUser remoteUser, ApplicationUser avatarUser, Avatar.Size size) throws AvatarsDisabledException Returns the URL for the avatar of the user having the given username for displaying on a page that should be shown for the passed in remoteUser.If the user does not have a custom avatar, or if the calling user does not have permission to view the Avatar, this method returns the URL of the default avatar. If the user does not exist, this method returns the URL of the anonymous avatar.
- Parameters:
remoteUser
- a User object for the currently logged in useravatarUser
- a User to get the avatar for (if null, the default avatar is used)size
- the size of the avatar to be displayed (if null, the default size is used)- Returns:
- a URL that can be used to display the avatar
- Throws:
AvatarsDisabledException
- if avatars are disabled- Since:
- v6.0
- See Also:
-
getGravatarAvatarURL
If Gravatar is enabled returns Gravatar url for given user at given size.- Parameters:
avatarUser
- a User to get the avatar for (if null, Optional.empty() is returned)size
- the size of the avatar to be displayed (if null, the default size is used)- Returns:
- a URL that can be used to display the avatar
- Since:
- v7.1
-
getAvatarUrlNoPermCheck
Deprecated.UsegetAvatarUrlNoPermCheck(ApplicationUser, Size)
. Since v6.0This is the same asgetAvatarURL(ApplicationUser, String, Size)
but does no permission checking.- Parameters:
username
- a String containing a username (may have been deleted)size
- the size of the avatar to be displayed- Returns:
- a URL that can be used to display the avatar
- Throws:
AvatarsDisabledException
- if avatars are disabled- Since:
- v5.0
-
getAvatarUrlNoPermCheck
URI getAvatarUrlNoPermCheck(ApplicationUser avatarUser, Avatar.Size size) throws AvatarsDisabledException This is the same asgetAvatarURL(ApplicationUser, String, Size)
but does no permission checking.- Parameters:
avatarUser
- a String containing a username (if null, the default avatar is used)size
- the size of the avatar to be displayed- Returns:
- a URL that can be used to display the avatar
- Throws:
AvatarsDisabledException
- if avatars are disabled- Since:
- v6.0
-
getAvatarUrlNoPermCheck
@Deprecated URI getAvatarUrlNoPermCheck(ApplicationUser applicationUser, Avatar avatar, @Nonnull Avatar.Size size) throws AvatarsDisabledException Deprecated.Returns the URL for an avatar.- Parameters:
applicationUser
-size
- the size of the avatar to be displayed (if null, the default size is used)- Returns:
- a URL that can be used to display the avatar
- Throws:
AvatarsDisabledException
- if avatars are disabled- Since:
- v6.3
- See Also:
-
getAvatarAbsoluteURL
URI getAvatarAbsoluteURL(ApplicationUser remoteUser, String username, Avatar.Size size) throws AvatarsDisabledException Deprecated.UsegetAvatarAbsoluteURL(ApplicationUser, ApplicationUser, Size)
. Since v6.0This is the same asgetAvatarURL(ApplicationUser, String, Avatar.Size)
but returns an absolute URL.- Throws:
AvatarsDisabledException
-
getAvatarAbsoluteURL
URI getAvatarAbsoluteURL(ApplicationUser remoteUser, ApplicationUser avatarUser, Avatar.Size size) throws AvatarsDisabledException This is the same asgetAvatarURL(ApplicationUser, String, Avatar.Size)
but returns an absolute URL.- Throws:
AvatarsDisabledException
- Since:
- v6.0
-
getProjectAvatarURL
Returns the URL for the avatar of the given project.If running in the context of a web request, this will return a URL relative to the server root (ie "/jira/..."). Otherwise, it will return an absolute URL (eg. "http://example.com/jira/...").
- Parameters:
project
- the Project of which to get the avatar URLsize
- the size of the avatar to be displayed (if null, the default size is used)- Returns:
- a URL that can be used to display the avatar
-
getProjectAvatarAbsoluteURL
Returns the URL for the avatar of the given project.This will always return an absolute URL (eg. "http://example.com/jira/...").
- Parameters:
project
- the Project of which to get the avatar URLsize
- the size of the avatar to be displayed (if null, the default size is used)- Returns:
- a URL that can be used to display the avatar
-
getProjectDefaultAvatarURL
Returns the URL for the default avatar of a project.If running in the context of a web request, this will return a URL relative to the server root (ie "/jira/..."). Otherwise, it will return an absolute URL (eg. "http://example.com/jira/...").
- Parameters:
size
- the size of the avatar to be displayed (if null, the default size is used)- Returns:
- a URL that can be used to display the avatar
-
getProjectDefaultAvatarAbsoluteURL
Returns the URL for the default avatar of a project.This will always return an absolute URL (eg. "http://example.com/jira/...").
- Parameters:
size
- the size of the avatar to be displayed (if null, the default size is used)- Returns:
- a URL that can be used to display the avatar
-
hasCustomUserAvatar
Deprecated.Returns true if the user has configured a custom avatar, false otherwise.- Parameters:
remoteUser
- a User object for the currently logged in userusername
- the username of the user whose avatar we will check- Returns:
- a boolean indicating whether the given user has configued a custom avatar
- Since:
- v5.0.3
-
hasCustomUserAvatar
Returns true if the user has configured a custom avatar, false otherwise.- Parameters:
remoteUser
- a User object for the currently logged in userusername
- the username of the user whose avatar we will check- Returns:
- a boolean indicating whether the given user has configued a custom avatar
- Since:
- v6.0
-
isGravatarEnabled
Deprecated.this is an avatar-provider plugin-implementation-specific concernReturns true if Gravatar support is enabled.- Returns:
- a boolean indicating whether Gravatar support is on
-
isUsingExternalAvatar
Check whether a user currently has an external avatar (for example, a Gravatar). UsegetAvatarURL(ApplicationUser, ApplicationUser)
to get the avatar URL.- Returns:
- a boolean indicating whether the given currently user has an external avatar
- Since:
- JIRA 6.3
-
setCustomUserAvatar
@ExperimentalApi void setCustomUserAvatar(ApplicationUser remoteUser, String username, Long avatarId) throws AvatarsDisabledException, NoPermissionException Deprecated.UsesetCustomUserAvatar(ApplicationUser, ApplicationUser, Long)
. Since v6.0Sets a custom avatar for a given user.- Parameters:
remoteUser
- a User object for the currently logged in userusername
- the username of the user whose avatar we will configureavatarId
- the id of the avatar to configure for the user- Throws:
AvatarsDisabledException
- if avatars are disabledNoPermissionException
- if the remote user does not have permission to update the given user's avatar- Since:
- v5.0.3
- See Also:
-
setCustomUserAvatar
@ExperimentalApi void setCustomUserAvatar(ApplicationUser remoteUser, ApplicationUser user, Long avatarId) throws AvatarsDisabledException, NoPermissionException Sets a custom avatar for a given user.- Parameters:
remoteUser
- a User object for the currently logged in useruser
- the user whose avatar we will configureavatarId
- the id of the avatar to configure for the user- Throws:
AvatarsDisabledException
- if avatars are disabledNoPermissionException
- if the remote user does not have permission to update the given user's avatar- Since:
- v6.0
- See Also:
-
canSetCustomUserAvatar
Deprecated.UsecanSetCustomUserAvatar(ApplicationUser, ApplicationUser)
. Since v6.0Returns a boolean indicating whether the calling user can edit the custom user avatar for the user with the given username.- Parameters:
remoteUser
- a User object for the currently logged in userusername
- the username of the user whose avatar we will configure- Returns:
- a indicating whether the calling user can edit the custom user avatar for another user
- Since:
- v5.0.3
-
canSetCustomUserAvatar
Returns a boolean indicating whether the calling user can edit the custom user avatar for the user with the given username.- Parameters:
remoteUser
- a User object for the currently logged in useruser
- the user whose avatar we will configure- Returns:
- a indicating whether the calling user can edit the custom user avatar for another user
- Since:
- v6.0
-
getAvatarTagged
Avatar getAvatarTagged(ApplicationUser remoteUser, ApplicationUser avatarUser) throws AvatarsDisabledException - Throws:
AvatarsDisabledException
-
canSetCustomUserAvatar(ApplicationUser, ApplicationUser)
.