|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface UserBiz
Business interface for users.
Field Summary | |
---|---|
static int |
ACCESS_ADMIN
Bit flag for Admin user access level. |
static java.lang.String |
DO_NOT_CHANGE_VALUE
Flag for a String value that should not change. |
static java.lang.String |
WATERMARK_META_KEY
The metadata key for the user watermark path. |
Method Summary | |
---|---|
User |
confirmForgotPassword(java.lang.String login,
java.lang.String confirmationCode,
java.lang.String newPassword,
BizContext context)
Confirm a forgotten password. |
User |
confirmRegisteredUser(java.lang.String login,
java.lang.String confirmationCode,
BizContext context)
Confirm a registered user. |
java.lang.String |
forgotPassword(java.lang.String login,
BizContext context)
Call to email a user a link with a one-time password. |
java.util.List<Album> |
getAlbumFeedForUser(AlbumFeedCommand command)
Get a List of Albums for a user's album feed. |
java.util.List<Album> |
getAlbumsForUser(User user,
BizContext context)
Get all albums for a given user. |
User |
getAnonymousUser()
Get an anonymous user object. |
Collection |
getCollection(java.lang.Long collectionId,
BizContext context)
Get a single collection. |
java.io.File |
getCollectionDirectory(Collection collection,
BizContext context)
Get the directory for a given collection. |
java.util.List<Collection> |
getCollectionsForUser(User user,
BizContext context)
Get all collections for a given user. |
java.util.List<Album> |
getSharedAlbumsForUser(BrowseAlbumsCommand command)
Get a List of Albums for a browse command. |
User |
getUserByAnonymousKey(java.lang.String key)
Get a User by its anonymous key. |
User |
getUserById(java.lang.Long userId,
BizContext context)
Get a User by its ID. |
java.util.Locale |
getUserLocale(User user,
BizContext context)
Get the Locale for a User. |
java.util.List<User> |
getUsersWithAccess(int level)
Get a list of User objects that have a specific access level. |
org.springframework.core.io.Resource |
getUserWatermark(java.lang.Long userId)
Get a Resource for a user's watermark. |
boolean |
hasAccessLevel(User user,
int level)
Return true if the supplied user has the specified access level. |
boolean |
isAnonymousUser(User user)
Test if a User is an anonoymous user. |
User |
logonUser(java.lang.String login,
java.lang.String password)
Authenticate a user by their username and password. |
Collection |
newCollectionForUser(Collection collection,
User user,
BizContext context)
Create a new Collection for a given user. |
java.lang.String |
registerUser(User user,
BizContext context)
Register a new user. |
void |
removeUser(java.lang.Long userId,
BizContext context)
Remove a User from the back end. |
java.lang.Long |
storeCollection(Collection collection,
BizContext context)
Store a collection in the back end. |
java.lang.Long |
storeUser(User user,
BizContext context)
Store a User in the back end. |
void |
storeUserPreferences(PreferencesCommand command,
BizContext context)
Store user preferences in the back end. |
Field Detail |
---|
static final int ACCESS_ADMIN
static final java.lang.String WATERMARK_META_KEY
static final java.lang.String DO_NOT_CHANGE_VALUE
For example, when updating a User, the password field can be left unchagned when set to this value.
Method Detail |
---|
java.lang.String registerUser(User user, BizContext context) throws AuthorizationException
Use this method to register a new user. After registration
the user will be stored in the back end, but the user will
require confirmation before they can officially log into the
application (see confirmRegisteredUser(String, String, BizContext)
).
user
- the new user to registercontext
- the BizContext
confirmRegisteredUser(String, String, BizContext)
AuthorizationException
- if the desired login is taken already,
this exception will be thrown with the reason code
AuthorizationException.Reason#DUPLICATE_LOGIN
User confirmRegisteredUser(java.lang.String login, java.lang.String confirmationCode, BizContext context) throws AuthorizationException
After a user has registered (see registerUser(User, BizContext)
) they
must confirm the registration via this method. After confirmation the
user can login via logonUser(String, String)
as a normal
user.
login
- the login to confirmconfirmationCode
- the confirmation codecontext
- the BizContext
AuthorizationException
- if the confirmationCode does not match
then the reason code will be set to AuthorizationException.Reason#REGISTRATION_NOT_CONFIRMED
,
if the login is not found then AuthorizationException.Reason#UNKNOWN_LOGIN
, if
the account has already been confirmed then
AuthorizationException.Reason#REGISTRATION_ALREADY_CONFIRMED
java.lang.Long storeUser(User user, BizContext context) throws AuthorizationException
This method will accept new users as well as updates to existing users.
When updating an existing user, if the User's password field
is set to DO_NOT_CHANGE_VALUE
then the User's password
will not be updated in the back end.
user
- the user to storecontext
- the current context
AuthorizationException
- if the current user is not authorized to update
this uservoid storeUserPreferences(PreferencesCommand command, BizContext context) throws AuthorizationException
command
- the preferences to storecontext
- the current context
AuthorizationException
- if the current user is not authorized to update
this userorg.springframework.core.io.Resource getUserWatermark(java.lang.Long userId)
userId
- the ID of the user to get the watermark resource for
void removeUser(java.lang.Long userId, BizContext context)
userId
- the ID of the User to removecontext
- the current contextUser logonUser(java.lang.String login, java.lang.String password) throws AuthorizationException
login
- the login name of the user to logonpassword
- the attempted password
AuthorizationException
- if user not found or password
does not matchUser getUserById(java.lang.Long userId, BizContext context)
userId
- the ID of the user to getcontext
- the current context
User getUserByAnonymousKey(java.lang.String key)
key
- the key of the user to get
java.util.Locale getUserLocale(User user, BizContext context)
user
- the user to get the Locale forcontext
- the current context
java.io.File getCollectionDirectory(Collection collection, BizContext context)
collection
- the collection to get the root directory forcontext
- the current context
Collection getCollection(java.lang.Long collectionId, BizContext context)
The collection items need not be populated here. See the
MediaBiz.getCollectionWithItems(Long, BizContext)
method
for that.
collectionId
- the ID of the collection to getcontext
- the current context
java.lang.Long storeCollection(Collection collection, BizContext context) throws AuthorizationException
This method will accept new collections as well as updates to existing collections.
collection
- the collection to storecontext
- the current context
AuthorizationException
- if the current user is not authorized to update
this collectionjava.util.List<Collection> getCollectionsForUser(User user, BizContext context)
Note this method is not presumed to return Collection instances populated
with the MediaItem
instances associated
with each Collection. That is assumed to be a very expensive operation, so
the implementation need not bother returning "complete" Collection instanes.
user
- the user to get collections forcontext
- the current context
Collection newCollectionForUser(Collection collection, User user, BizContext context)
collection
- the collection object to associate with the useruser
- the usercontext
- the current context
java.util.List<Album> getAlbumsForUser(User user, BizContext context)
Note this method is not presumed to return Album instances populated
with the MediaItem
instances associated
with each Album. That is assumed to be a very expensive operation, so
the implementation need not bother returning "complete" Album instanes.
user
- the user to get albums forcontext
- the current context
java.util.List<Album> getAlbumFeedForUser(AlbumFeedCommand command)
command
- the command
java.util.List<Album> getSharedAlbumsForUser(BrowseAlbumsCommand command)
command
- the browse command
boolean hasAccessLevel(User user, int level)
user
- the user to testlevel
- the level (use the ACCESS_*
constants)
java.lang.String forgotPassword(java.lang.String login, BizContext context) throws AuthorizationException
Calling this method will do the following:
confirmForgotPassword(String, String, String, BizContext)
login
- the login of the user that forgot their passwordcontext
- the current context
confirmForgotPassword(String, String, String, BizContext)
AuthorizationException
- if the login is not found the reason
code will be set to AuthorizationException.Reason#UNKNOWN_LOGIN
User confirmForgotPassword(java.lang.String login, java.lang.String confirmationCode, java.lang.String newPassword, BizContext context) throws AuthorizationException
login
- the login of the user being confirmedconfirmationCode
- the confirmation code issued by a previous
call to forgotPassword(String, BizContext)
newPassword
- the new password to setcontext
- the current context
AuthorizationException
- if the login is not found the reason
code will be set to AuthorizationException.Reason#UNKNOWN_LOGIN
, if the confirmationCode
does not match then the reason code will be set to
AuthorizationException.Reason#FORGOTTEN_PASSWORD_NOT_CONFIRMED
java.util.List<User> getUsersWithAccess(int level)
level
- the access level
User getAnonymousUser()
boolean isAnonymousUser(User user)
user
- the user to test
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |