Package ome.api
Interface IAdmin
-
- All Superinterfaces:
ServiceInterface
public interface IAdmin extends ServiceInterface
Administration interface providing access to admin-only functionality as well as JMX-based server access and selected user functions. Most methods require membership in privilegedgroups. Methods which returnExperimenterorExperimenterGroupinstances fetch and load all related instances ofExperimenterGrouporExperimenter, respectively.- Since:
- OME3.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidaddGroupOwners(ome.model.meta.ExperimenterGroup group, ome.model.meta.Experimenter... owner)adds the given users to the owner list for this group.voidaddGroups(ome.model.meta.Experimenter user, ome.model.meta.ExperimenterGroup... groups)adds a user to the given groups.booleancanUpdate(ome.model.IObject obj)Returns true if the currently logged in user can modify the givenIObject.voidchangeExpiredCredentials(java.lang.String name, java.lang.String oldCred, java.lang.String newCred)Used after anExpiredCredentialExceptioninstance is thrown.voidchangeGroup(ome.model.IObject iObject, java.lang.String groupName)calldetails.setGroup()on this instance.voidchangeOwner(ome.model.IObject iObject, java.lang.String omeName)calldetails.setOwner()on this instance.voidchangePassword(java.lang.String newPassword)change the password for the current user.voidchangePasswordWithOldPassword(java.lang.String oldPassword, java.lang.String newPassword)change the password for the current user by passing the old password.voidchangePermissions(ome.model.IObject iObject, ome.model.internal.Permissions perms)calldefaults.setPermissions()on this instance.voidchangeUserPassword(java.lang.String omeName, java.lang.String newPassword)change the password for the a given user.ome.model.meta.Experimenter[]containedExperimenters(long groupId)fetch alluserscontained in this group.ome.model.meta.ExperimenterGroup[]containedGroups(long experimenterId)fetch allgroupsof which the given user is a member.longcreateExperimenter(ome.model.meta.Experimenter experimenter, ome.model.meta.ExperimenterGroup defaultGroup, ome.model.meta.ExperimenterGroup... otherGroups)create and return a new user in the given groups.longcreateExperimenterWithPassword(ome.model.meta.Experimenter experimenter, java.lang.String password, ome.model.meta.ExperimenterGroup defaultGroup, ome.model.meta.ExperimenterGroup... otherGroups)create and return a new user in the given groups with password.longcreateGroup(ome.model.meta.ExperimenterGroup group)create and return a new group.longcreateRestrictedSystemUser(ome.model.meta.Experimenter newSystemUser, java.util.List<ome.model.enums.AdminPrivilege> privileges)Create and return a new system user.longcreateRestrictedSystemUserWithPassword(ome.model.meta.Experimenter newSystemUser, java.util.List<ome.model.enums.AdminPrivilege> privileges, java.lang.String password)Create and return a new system user.longcreateSystemUser(ome.model.meta.Experimenter newSystemUser)create and return a new system user.longcreateUser(ome.model.meta.Experimenter newUser, java.lang.String group)create and return a new user.voiddeleteExperimenter(ome.model.meta.Experimenter user)removes a user by removing the password information for that user as well as allGroupExperimenterMapinstances.voiddeleteGroup(ome.model.meta.ExperimenterGroup group)removes a group by first removing all users in the group, and then deleting the actualExperimenterGroupinstance.java.util.List<ome.model.enums.AdminPrivilege>getAdminPrivileges(ome.model.meta.Experimenter user)Gets the light administrator privileges for the given user.java.util.List<ome.model.meta.Experimenter>getAdminsWithPrivileges(java.util.List<ome.model.enums.AdminPrivilege> privileges)Gets the administrators who have all the given privileges.java.util.List<ome.model.enums.AdminPrivilege>getCurrentAdminPrivileges()Gets the light administrator privileges for the current user.ome.model.meta.ExperimenterGroupgetDefaultGroup(long experimenterId)retrieve the defaultgroupfor the given user id.EventContextgetEventContext()returns an implementation ofEventContextloaded with the security for the current user and thread.ome.model.meta.ExperimentergetExperimenter(long id)fetch anExperimenterand all relatedgroups.ome.model.meta.ExperimenterGroupgetGroup(long id)fetch anExperimenterGroupand all containedusers.java.util.List<java.lang.Long>getLeaderOfGroupIds(ome.model.meta.Experimenter e)Finds the ids for all groups for which the givenExperimenteris owner/leader.java.util.List<java.lang.Long>getMemberOfGroupIds(ome.model.meta.Experimenter e)Finds the ids for all groups for which the givenExperimenteris a member.java.util.List<ome.model.core.OriginalFile>getMyUserPhotos()Retrieve theOriginalFileobject attached to this user as specified byuploadMyUserPhoto(String, String, byte[]).RolesgetSecurityRoles()returns the activeRolesin use by the server.ome.model.meta.ExperimenterlookupExperimenter(java.lang.String omeName)look up anExperimenterand all relatedgroupsby name.java.util.List<ome.model.meta.Experimenter>lookupExperimenters()Looks up allexperimenterspresent and all relatedgroups.ome.model.meta.ExperimenterGrouplookupGroup(java.lang.String groupName)look up anExperimenterGroupand all containedusersby name.java.util.List<ome.model.meta.ExperimenterGroup>lookupGroups()Looks up allgroupspresent and all relatedexperimenters.java.lang.StringlookupLdapAuthExperimenter(long id)Looks upexperimenterswho uses LDAP authentication (has set dn on password table).java.util.List<java.util.Map<java.lang.String,java.lang.Object>>lookupLdapAuthExperimenters()Looks up all id ofexperimenterswho uses LDAP authentication (has set dn on password table).voidmoveToCommonSpace(ome.model.IObject... iObjects)Moves the given objects into the "user" group to make them visible and linkable from all security contexts.voidremoveGroupOwners(ome.model.meta.ExperimenterGroup group, ome.model.meta.Experimenter... owner)removes the given users from the owner list for this group.voidremoveGroups(ome.model.meta.Experimenter user, ome.model.meta.ExperimenterGroup... groups)Removes an experimenter from the given groups.voidreportForgottenPassword(java.lang.String name, java.lang.String email)Deprecated.voidsetAdminPrivileges(ome.model.meta.Experimenter user, java.util.List<ome.model.enums.AdminPrivilege> privileges)Sets the set of light administrator privileges for the given user.voidsetDefaultGroup(ome.model.meta.Experimenter user, ome.model.meta.ExperimenterGroup group)sets the default group for a given user.voidsetGroupOwner(ome.model.meta.ExperimenterGroup group, ome.model.meta.Experimenter owner)adds the user to the owner list for this group.voidsynchronizeLoginCache()uses JMX to refresh the login cache if supported.voidunsetGroupOwner(ome.model.meta.ExperimenterGroup group, ome.model.meta.Experimenter owner)removes the user from the owner list for this group.voidupdateExperimenter(ome.model.meta.Experimenter experimenter)Updates an experimenter if admin or owner of group.voidupdateExperimenterWithPassword(ome.model.meta.Experimenter experimenter, java.lang.String password)Updates an experimenter if admin or owner of group.voidupdateGroup(ome.model.meta.ExperimenterGroup group)Updates an experimenter group if admin or owner of group.voidupdateSelf(ome.model.meta.Experimenter experimenter)Allows a user to update his/her own information.longuploadMyUserPhoto(java.lang.String filename, java.lang.String format, byte[] data)Uploads a photo for the user which will be displayed on his/her profile.
-
-
-
Method Detail
-
canUpdate
boolean canUpdate(ome.model.IObject obj)
Returns true if the currently logged in user can modify the givenIObject. This uses the same logic that would be applied during a Hibernate flush to the database.
-
getExperimenter
ome.model.meta.Experimenter getExperimenter(long id)
fetch anExperimenterand all relatedgroups.- Parameters:
id- id of the Experimenter- Returns:
- an Experimenter. Never null.
- Throws:
ome.conditions.ApiUsageException- if id does not exist.
-
lookupExperimenter
ome.model.meta.Experimenter lookupExperimenter(java.lang.String omeName)
look up anExperimenterand all relatedgroupsby name.- Parameters:
omeName- Name of the Experimenter- Returns:
- an Experimenter. Never null.
- Throws:
ome.conditions.ApiUsageException- if omeName does not exist.
-
lookupExperimenters
java.util.List<ome.model.meta.Experimenter> lookupExperimenters()
Looks up allexperimenterspresent and all relatedgroups.- Returns:
- all Experimenters. Never null.
-
lookupLdapAuthExperimenters
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> lookupLdapAuthExperimenters()
Looks up all id ofexperimenterswho uses LDAP authentication (has set dn on password table).- Returns:
- list of Experimenters. Never null.
-
lookupLdapAuthExperimenter
java.lang.String lookupLdapAuthExperimenter(long id)
Looks upexperimenterswho uses LDAP authentication (has set dn on password table).- Returns:
- Experimenter. Never null.
-
getGroup
ome.model.meta.ExperimenterGroup getGroup(long id)
fetch anExperimenterGroupand all containedusers.- Parameters:
id- id of the ExperimenterGroup- Returns:
- an ExperimenterGroup. Never null.
- Throws:
ome.conditions.ApiUsageException- if id does not exist.
-
lookupGroup
ome.model.meta.ExperimenterGroup lookupGroup(java.lang.String groupName)
look up anExperimenterGroupand all containedusersby name.- Parameters:
groupName- Name of the ExperimenterGroup- Returns:
- an ExperimenterGroup. Never null.
- Throws:
ome.conditions.ApiUsageException- if groupName does not exist.
-
lookupGroups
java.util.List<ome.model.meta.ExperimenterGroup> lookupGroups()
Looks up allgroupspresent and all relatedexperimenters. The experimenters' groups are also loaded.- Returns:
- all Groups. Never null.
-
containedExperimenters
ome.model.meta.Experimenter[] containedExperimenters(long groupId)
fetch alluserscontained in this group. The returned users will have all fields filled in and all collections unloaded.- Parameters:
groupId- id of the ExperimenterGroup- Returns:
- non-null array of all
usersin this group.
-
containedGroups
ome.model.meta.ExperimenterGroup[] containedGroups(long experimenterId)
fetch allgroupsof which the given user is a member. The returned groups will have all fields filled in and all collections unloaded.- Parameters:
experimenterId- id of the Experimenter. Not null.- Returns:
- non-null array of all
groupsfor this user.
-
getDefaultGroup
ome.model.meta.ExperimenterGroup getDefaultGroup(long experimenterId)
retrieve the defaultgroupfor the given user id.- Parameters:
experimenterId- of the Experimenter. Not null.- Returns:
- non-null
ExperimenterGroup. If no default group is found, an exception will be thrown.
-
getLeaderOfGroupIds
java.util.List<java.lang.Long> getLeaderOfGroupIds(ome.model.meta.Experimenter e)
Finds the ids for all groups for which the givenExperimenteris owner/leader.- Parameters:
e- Non-null, managed (i.e. with id)Experimenter- See Also:
ExperimenterGroup.getDetails(),Details.getOwner()
-
getMemberOfGroupIds
java.util.List<java.lang.Long> getMemberOfGroupIds(ome.model.meta.Experimenter e)
Finds the ids for all groups for which the givenExperimenteris a member.- Parameters:
e- Non-null, managed (i.e. with id)Experimenter- See Also:
ExperimenterGroup.getDetails(),Details.getOwner()
-
updateSelf
void updateSelf(ome.model.meta.Experimenter experimenter)
Allows a user to update his/her own information. This is limited to the fields on Experimenter, all other fields (groups, etc.) are ignored. The experimenter argument need not have the proper id nor the proper omeName (which is immutable). To change the users default group (which is the only other customizable option), usesetDefaultGroup(Experimenter, ExperimenterGroup)- Parameters:
experimenter- A data transfer object. Only the fields: firstName, middleName, lastName, email, and institution are checked. Not null.- See Also:
setDefaultGroup(Experimenter, ExperimenterGroup)
-
uploadMyUserPhoto
long uploadMyUserPhoto(java.lang.String filename, java.lang.String format, byte[] data)Uploads a photo for the user which will be displayed on his/her profile. This photo will be saved as anOriginalFileobject with the given format, and attached to the user'sExperimenterobject via anFileAnnotationwith the namespace: "openmicroscopy.org/omero/experimenter/photo" (NSEXPERIMENTERPHOTO). If such anOriginalFileinstance already exists, it will be overwritten. If more than one photo is present, the oldest version will be modified (i.e. the highest updateEvent id). Note: as outlined in ticket:1794, this photo will be placed in the "user" group and therefore will be visible to everyone on the system.- Parameters:
filename- Not null. String name which will be used.format- Not null. Format.value string. 'image/jpeg' and 'image/png' are common values.data- Not null. Data from the image. This will be written to disk.- Returns:
- the id of the overwritten or newly created user photo OriginalFile object.
-
getMyUserPhotos
java.util.List<ome.model.core.OriginalFile> getMyUserPhotos()
Retrieve theOriginalFileobject attached to this user as specified byuploadMyUserPhoto(String, String, byte[]). The return value is order by the most recently modified file first.- Returns:
- file objects. Possibly empty.
-
updateExperimenter
void updateExperimenter(ome.model.meta.Experimenter experimenter)
Updates an experimenter if admin or owner of group. Only string fields on the object are taken into account. The root and guest experimenters may not be renamed. Before a SecurityViolation would be thrown, however, this method will pass toupdateSelf(Experimenter)if the current user matches the given experimenter.- Parameters:
experimenter- the Experimenter to update.
-
updateExperimenterWithPassword
void updateExperimenterWithPassword(ome.model.meta.Experimenter experimenter, java.lang.String password)Updates an experimenter if admin or owner of group. Only string fields on the object are taken into account. The root and guest experimenters may not be renamed.- Parameters:
experimenter- the Experimenter to update.password- Not-null. Must pass validation in the security sub-system.
-
updateGroup
void updateGroup(ome.model.meta.ExperimenterGroup group)
Updates an experimenter group if admin or owner of group. Only string fields on the object are taken into account. The root, system and guest groups may not be renamed, nor may the user's current group.- Parameters:
group- the ExperimenterGroup to update.
-
createUser
long createUser(ome.model.meta.Experimenter newUser, java.lang.String group)create and return a new user. This user will be created with the default group specified.- Parameters:
newUser- a newExperimenterinstancegroup- group name of the default group for this user- Returns:
- id of the newly created
Experimenter
-
createSystemUser
long createSystemUser(ome.model.meta.Experimenter newSystemUser)
create and return a new system user. This user will be created with the "System" (administration) group as default and will also be in the "user" group.- Parameters:
newSystemUser- a newExperimenterinstance- Returns:
- id of the newly created
Experimenter
-
createRestrictedSystemUser
long createRestrictedSystemUser(ome.model.meta.Experimenter newSystemUser, java.util.List<ome.model.enums.AdminPrivilege> privileges)Create and return a new system user. This user will be created with the "System" (administration) group as default and will also be in the "user" group.- Parameters:
newSystemUser- a newExperimenterinstanceprivileges- the privileges to set for the user- Returns:
- id of the newly created
Experimenter
-
createRestrictedSystemUserWithPassword
long createRestrictedSystemUserWithPassword(ome.model.meta.Experimenter newSystemUser, java.util.List<ome.model.enums.AdminPrivilege> privileges, java.lang.String password)Create and return a new system user. This user will be created with the "System" (administration) group as default and will also be in the "user" group.- Parameters:
newSystemUser- a newExperimenterinstanceprivileges- the privileges to set for the userpassword- the password to set for the user- Returns:
- id of the newly created
Experimenter
-
createExperimenter
long createExperimenter(ome.model.meta.Experimenter experimenter, ome.model.meta.ExperimenterGroup defaultGroup, ome.model.meta.ExperimenterGroup... otherGroups)create and return a new user in the given groups.- Parameters:
experimenter- A newExperimenterinstance. Not null.defaultGroup- Instance ofExperimenterGroup. Not null.otherGroups- Array ofExperimenterGroupinstances. Can be null.- Returns:
- id of the newly created
ExperimenterNot null.
-
createExperimenterWithPassword
long createExperimenterWithPassword(ome.model.meta.Experimenter experimenter, java.lang.String password, ome.model.meta.ExperimenterGroup defaultGroup, ome.model.meta.ExperimenterGroup... otherGroups)create and return a new user in the given groups with password.- Parameters:
experimenter- A newExperimenterinstance. Not null.password- Not-null. Must pass validation in the security sub-system.defaultGroup- Instance ofExperimenterGroup. Not null.otherGroups- Array ofExperimenterGroupinstances. Can be null.- Returns:
- id of the newly created
ExperimenterNot null. - Throws:
ome.conditions.SecurityViolation- if the new password is too weak.
-
createGroup
long createGroup(ome.model.meta.ExperimenterGroup group)
create and return a new group. TheDetails.setPermissions(Permissions)method should be called on the instance which is passed. The givenPermissionswill become the default for all objects created while logged into this group, possibly modified by the user's umask settings. If no permissions is set, the default will bePermissions.USER_PRIVATE, i.e. a group in which no user can see the other group member's data.- Parameters:
group- a newExperimenterGroupinstance. Not null.- Returns:
- id of the newly created
ExperimenterGroup - See Also:
- ticket:1434"
-
addGroups
void addGroups(ome.model.meta.Experimenter user, ome.model.meta.ExperimenterGroup... groups)adds a user to the given groups.- Parameters:
user- A currently managed entity. Not null.groups- Groups to which the user will be added. Not null.
-
removeGroups
void removeGroups(ome.model.meta.Experimenter user, ome.model.meta.ExperimenterGroup... groups)Removes an experimenter from the given groups.- The root experimenter is required to be in both the user and system groups.
- An experimenter may not remove themself from the user or system group.
- An experimenter may not be a member of only the user group, some other group is also required as the default group.
- An experimenter must remain a member of some group.
- Parameters:
user- A currently managed entity. Not null.groups- Groups from which the user will be removed. Not null.
-
setDefaultGroup
void setDefaultGroup(ome.model.meta.Experimenter user, ome.model.meta.ExperimenterGroup group)sets the default group for a given user.- Parameters:
user- A currently managedExperimenter. Not null.group- The group which should be set as default group for this user. Not null.
-
setGroupOwner
void setGroupOwner(ome.model.meta.ExperimenterGroup group, ome.model.meta.Experimenter owner)adds the user to the owner list for this group. Since Beta4.2 (ticket:1434) multiple users can be the "owner" of a group.- Parameters:
group- A currently managedExperimenterGroup. Not null.owner- A currently managedExperimenter. Not null.
-
unsetGroupOwner
void unsetGroupOwner(ome.model.meta.ExperimenterGroup group, ome.model.meta.Experimenter owner)removes the user from the owner list for this group. Since Beta4.2 (ticket:1434) multiple users can be the "owner" of a group.- Parameters:
group- A currently managedExperimenterGroup. Not null.owner- A currently managedExperimenter. Not null.
-
addGroupOwners
void addGroupOwners(ome.model.meta.ExperimenterGroup group, ome.model.meta.Experimenter... owner)adds the given users to the owner list for this group.- Parameters:
group- A currently managedExperimenterGroup. Not null.owner- A set of currently managedExperimenters. Not null.
-
removeGroupOwners
void removeGroupOwners(ome.model.meta.ExperimenterGroup group, ome.model.meta.Experimenter... owner)removes the given users from the owner list for this group.- Parameters:
group- A currently managedExperimenterGroup. Not null.owner- A set of currently managedExperimenters. Not null.
-
deleteExperimenter
void deleteExperimenter(ome.model.meta.Experimenter user)
removes a user by removing the password information for that user as well as allGroupExperimenterMapinstances.- Parameters:
user- Experimenter to be deleted. Not null.
-
deleteGroup
void deleteGroup(ome.model.meta.ExperimenterGroup group)
removes a group by first removing all users in the group, and then deleting the actualExperimenterGroupinstance.- Parameters:
group-ExperimenterGroupto be deleted. Not null.
-
changeOwner
void changeOwner(ome.model.IObject iObject, java.lang.String omeName)calldetails.setOwner()on this instance. It is valid for the instance to beunloaded(or constructed with an unloading-constructor.)- Parameters:
iObject- An entity or an unloaded reference to an entity. Not null.omeName- The user name who should gain ownership of this entity. Not null.
-
changeGroup
void changeGroup(ome.model.IObject iObject, java.lang.String groupName)calldetails.setGroup()on this instance. It is valid for the instance to beunloaded(or constructed with an unloading-constructor.)- Parameters:
iObject- An entity or an unloaded reference to an entity. Not null.groupName- The group name who should gain ownership of this entity. Not null.
-
changePermissions
void changePermissions(ome.model.IObject iObject, ome.model.internal.Permissions perms)calldefaults.setPermissions()on this instance. It is valid for the instance to beunloaded(or constructed with an unloading-constructor.)- Parameters:
iObject- An entity or an unloaded reference to an entity. Not null.perms- The permissions value for this entity. Not null.
-
moveToCommonSpace
void moveToCommonSpace(ome.model.IObject... iObjects)
Moves the given objects into the "user" group to make them visible and linkable from all security contexts.- Parameters:
iObjects-- See Also:
- ticket 1794
-
reportForgottenPassword
@Deprecated void reportForgottenPassword(java.lang.String name, java.lang.String email) throws ome.conditions.AuthenticationExceptionDeprecated.Can be used after repeatedAuthenticationExceptioninstances are thrown, to request that an email with a temporary password be sent. The given email must match the email for the user listed under the name argument. The user must not be an administrator. Does not require a session to be active.- Parameters:
name-email-- Throws:
ome.conditions.AuthenticationException- when name and email do not match
-
changeExpiredCredentials
void changeExpiredCredentials(java.lang.String name, java.lang.String oldCred, java.lang.String newCred) throws ome.conditions.AuthenticationExceptionUsed after anExpiredCredentialExceptioninstance is thrown. Does not require- Throws:
ome.conditions.AuthenticationException
-
changePassword
void changePassword(java.lang.String newPassword)
change the password for the current user.Warning:This method requires the user to be authenticated with a password and not with a one-time session id. To avoid this problem, use
changePasswordWithOldPassword(String, String).- Parameters:
newPassword- Possibly null to allow logging in with no password.- Throws:
ome.conditions.SecurityViolation- if the user is not authenticated with a password.- See Also:
- ticket:911, ticket:3201
-
changePasswordWithOldPassword
void changePasswordWithOldPassword(java.lang.String oldPassword, java.lang.String newPassword)change the password for the current user by passing the old password.- Parameters:
oldPassword- Not-null. Must pass validation in the security sub-system.newPassword- Possibly null to allow logging in with no password.- Throws:
ome.conditions.SecurityViolation- if the oldPassword is incorrect.
-
changeUserPassword
void changeUserPassword(java.lang.String omeName, java.lang.String newPassword)change the password for the a given user.- Parameters:
newPassword- Not-null. Might must pass validation in the security sub-system.- Throws:
ome.conditions.SecurityViolation- if the new password is too weak.
-
synchronizeLoginCache
void synchronizeLoginCache()
uses JMX to refresh the login cache if supported. Some backends may not provide refreshing. This may be called internally during some other administrative tasks. The exact implementation of this depends on the application server and the authentication/authorization backend.
-
getAdminsWithPrivileges
java.util.List<ome.model.meta.Experimenter> getAdminsWithPrivileges(java.util.List<ome.model.enums.AdminPrivilege> privileges)
Gets the administrators who have all the given privileges. Consistent with the results fromgetAdminPrivileges(Experimenter).- Parameters:
privileges- the required privileges- Returns:
- the light administrators who have those privileges
-
getCurrentAdminPrivileges
java.util.List<ome.model.enums.AdminPrivilege> getCurrentAdminPrivileges()
Gets the light administrator privileges for the current user.- Returns:
- the current user's light administrator privileges
-
getAdminPrivileges
java.util.List<ome.model.enums.AdminPrivilege> getAdminPrivileges(ome.model.meta.Experimenter user)
Gets the light administrator privileges for the given user.- Parameters:
user- the user whose privileges are being queried- Returns:
- the user's light administrator privileges
-
setAdminPrivileges
void setAdminPrivileges(ome.model.meta.Experimenter user, java.util.List<ome.model.enums.AdminPrivilege> privileges)Sets the set of light administrator privileges for the given user.- Parameters:
user- the user whose privileges are to be setprivileges- the privileges to set for the user
-
getSecurityRoles
Roles getSecurityRoles()
returns the activeRolesin use by the server.- Returns:
- Non-null, immutable
Rolesinstance.
-
getEventContext
EventContext getEventContext()
returns an implementation ofEventContextloaded with the security for the current user and thread. If called remotely, not all values ofEventContextwill be sensible.- Returns:
- Non-null, immutable
EventContextinstance
-
-