ome.logic
Class AdminImpl

java.lang.Object
  extended by ome.logic.AbstractLevel2Service
      extended by ome.logic.AdminImpl
All Implemented Interfaces:
IAdmin, LocalAdmin, ServiceInterface, SelfConfigurableService, org.springframework.context.ApplicationContextAware

@Transactional(readOnly=true)
public class AdminImpl
extends AbstractLevel2Service
implements LocalAdmin, org.springframework.context.ApplicationContextAware

Provides methods for administering user accounts, passwords, as well as methods which require special privileges. Developer note: As can be expected, to perform these privileged the Admin service has access to several resources that should not be generally used while developing services. Misuse could circumvent security or auditing.

Since:
3.0-M3
Version:
$Revision:1754 $, $Date:2007-08-20 10:36:07 +0100 (Mon, 20 Aug 2007) $
Author:
Josh Moore, josh.moore at gmx.de
See Also:
SecuritySystem, Permissions

Field Summary
protected  ACLVoter aclVoter
           
protected  OmeroContext context
           
protected  LdapImpl ldapUtil
           
protected  org.springframework.mail.MailSender mailSender
           
protected static String NSEXPERIMENTERPHOTO
           
protected  SessionFactory osf
           
protected  PasswordProvider passwordProvider
           
protected  PasswordUtil passwordUtil
           
protected  RoleProvider roleProvider
           
protected  ome.util.SqlAction sql
           
protected  org.springframework.mail.SimpleMailMessage templateMessage
           
 
Fields inherited from class ome.logic.AbstractLevel2Service
iQuery, iUpdate, metadata, queryFactory, sec
 
Constructor Summary
AdminImpl(ome.util.SqlAction sql, SessionFactory osf, org.springframework.mail.MailSender mailSender, org.springframework.mail.SimpleMailMessage templateMessage, ACLVoter aclVoter, PasswordProvider passwordProvider, RoleProvider roleProvider, LdapImpl ldapUtil, PasswordUtil passwordUtil)
           
 
Method Summary
 void addGroupOwners(ome.model.meta.ExperimenterGroup group, ome.model.meta.Experimenter... owner)
          adds the given users to the owner list for this group.
 void addGroups(ome.model.meta.Experimenter user, ome.model.meta.ExperimenterGroup... groups)
          adds a user to the given groups.
protected  void assertManaged(ome.model.IObject o)
           
 boolean canUpdate(ome.model.IObject obj)
          Returns true if the currently logged in user can modify the given IObject.
 void changeExpiredCredentials(String name, String oldCred, String newCred)
          Used after an ExpiredCredentialsException instance is thrown.
 void changeGroup(ome.model.IObject iObject, String groupName)
          call details.setGroup() on this instance.
 void changeOwner(ome.model.IObject iObject, String omeName)
          call details.setOwner() on this instance.
 void changePassword(String newPassword)
          change the password for the current user.
 void changePasswordWithOldPassword(String oldPassword, String newPassword)
          change the password for the current user by passing the old password.
 void changePermissions(ome.model.IObject iObject, ome.model.internal.Permissions perms)
          the implementation of this method is somewhat tricky in that Permissions changes must be allowed even when other updates are not.
 void changeUserPassword(String user, String newPassword)
          change the password for the a given user.
 boolean checkPassword(String name, String password, boolean readOnly)
          If ldap plugin turned, creates Ldap accounts and authentication by LDAP available.
 ome.model.meta.Experimenter[] containedExperimenters(long groupId)
          fetch all users contained in this group.
 ome.model.meta.ExperimenterGroup[] containedGroups(long experimenterId)
          fetch all groups of which the given user is a member.
 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.
 long createExperimenterWithPassword(ome.model.meta.Experimenter experimenter, String password, ome.model.meta.ExperimenterGroup defaultGroup, ome.model.meta.ExperimenterGroup... otherGroups)
          create and return a new user in the given groups with password.
 long createGroup(ome.model.meta.ExperimenterGroup group)
          create and return a new group.
 long createSystemUser(ome.model.meta.Experimenter newSystemUser)
          create and return a new system user.
 long createUser(ome.model.meta.Experimenter newUser, String defaultGroup)
          create and return a new user.
 void deleteExperimenter(ome.model.meta.Experimenter user)
          removes a user by removing the password information for that user as well as all GroupExperimenterMap instances.
 void deleteGroup(ome.model.meta.ExperimenterGroup group)
          removes a group by first removing all users in the group, and then deleting the actual ExperimenterGroup instance.
 ome.model.meta.ExperimenterGroup getDefaultGroup(long experimenterId)
          retrieve the default group for the given user id.
 EventContext getEventContext()
          returns an implementation of EventContext loaded with the security for the current user and thread.
 ome.model.meta.Experimenter getExperimenter(long id)
          fetch an Experimenter and all related groups.
 ome.model.meta.ExperimenterGroup getGroup(long id)
          fetch an ExperimenterGroup and all contained users.
 List<Long> getLeaderOfGroupIds(ome.model.meta.Experimenter e)
          Finds the ids for all groups for which the given Experimenter is owner/leader.
 Map<String,Long> getLockingIds(ome.model.IObject object)
          Returns a map from Class (as string) to a count for all entities which point to the given IObject.
 Map<String,Long> getLockingIds(ome.model.IObject object, Long groupId)
           
 List<Long> getMemberOfGroupIds(ome.model.meta.Experimenter e)
          Finds the ids for all groups for which the given Experimenter is a member.
 List<ome.model.core.OriginalFile> getMyUserPhotos()
          Retrieve the OriginalFile objectd attached to this user as specified by {@link #uploadMyUserPhoto(String, String, byte[]).
 Roles getSecurityRoles()
          returns the active Roles in use by the server.
 Class<? extends ServiceInterface> getServiceInterface()
           
 List<String> getUserRoles(ome.model.meta.Experimenter e)
          Finds the group names for all groups for which the given Experimenter is a member.
 ome.model.meta.ExperimenterGroup groupProxy(Long id)
          returns a possibly uninitialized proxy for the given group id.
 ome.model.meta.ExperimenterGroup groupProxy(String groupName)
          returns a possibly uninitialized proxy for the given group name.
 ome.model.meta.Experimenter lookupExperimenter(String omeName)
          look up an Experimenter and all related groups by name.
 List<ome.model.meta.Experimenter> lookupExperimenters()
          Looks up all experimenters present and all related groups.
 ome.model.meta.ExperimenterGroup lookupGroup(String groupName)
          look up an ExperimenterGroup and all contained users by name.
 List<ome.model.meta.ExperimenterGroup> lookupGroups()
          Looks up all groups present and all related experimenters.
 String lookupLdapAuthExperimenter(long id)
          Looks up experimenters who uses LDAP authentication (has set dn on password table).
 List<Map<String,Object>> lookupLdapAuthExperimenters()
          Looks up all id of experimenters who uses LDAP authentication (has set dn on password table).
 void moveToCommonSpace(ome.model.IObject... iObjects)
          Moves the given objects into the "user" group to make them visible and linkable from all security contexts.
 void removeGroupOwners(ome.model.meta.ExperimenterGroup group, ome.model.meta.Experimenter... owner)
          removes the given users from the owner list for this group.
 void removeGroups(ome.model.meta.Experimenter user, ome.model.meta.ExperimenterGroup... groups)
          removes a user from the given groups.
 void reportForgottenPassword(String name, String email)
          Can be used after repeated AuthenticationException instances are thrown, to request that an email with a temporary password be sent.
 void setApplicationContext(org.springframework.context.ApplicationContext ctx)
           
 void setDefaultGroup(ome.model.meta.Experimenter user, ome.model.meta.ExperimenterGroup group)
          sets the default group for a given user.
 void setGroupOwner(ome.model.meta.ExperimenterGroup group, ome.model.meta.Experimenter owner)
          adds the user to the owner list for this group.
 void synchronizeLoginCache()
          uses JMX to refresh the login cache if supported.
 void unsetGroupOwner(ome.model.meta.ExperimenterGroup group, ome.model.meta.Experimenter owner)
          removes the user from the owner list for this group.
 void updateExperimenter(ome.model.meta.Experimenter experimenter)
          Updates an experimenter if admin or owner of group.
 void updateExperimenterWithPassword(ome.model.meta.Experimenter experimenter, String password)
          Updates an experimenter if admin or owner of group.
 void updateGroup(ome.model.meta.ExperimenterGroup group)
          Updates an experimenter group if admin or owner of group.
 void updateSelf(ome.model.meta.Experimenter e)
          Allows a user to update his/her own information.
 long uploadMyUserPhoto(String filename, String mimetype, byte[] data)
          Uploads a photo for the user which will be displayed on his/her profile.
 ome.model.meta.Experimenter userProxy(Long id)
          returns a possibly uninitialized proxy for the given user id.
 ome.model.meta.Experimenter userProxy(String omeName)
          returns a possibly uninitialized proxy for the given user name.
 
Methods inherited from class ome.logic.AbstractLevel2Service
getBeanHelper, getExtendedMetadata, getQueryFactory, getSecuritySystem, selfConfigure, setExtendedMetadata, setQueryFactory, setQueryService, setSecuritySystem, setUpdateService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sql

protected final ome.util.SqlAction sql

osf

protected final SessionFactory osf

mailSender

protected final org.springframework.mail.MailSender mailSender

templateMessage

protected final org.springframework.mail.SimpleMailMessage templateMessage

aclVoter

protected final ACLVoter aclVoter

passwordProvider

protected final PasswordProvider passwordProvider

roleProvider

protected final RoleProvider roleProvider

passwordUtil

protected final PasswordUtil passwordUtil

ldapUtil

protected final LdapImpl ldapUtil

context

protected OmeroContext context

NSEXPERIMENTERPHOTO

protected static final String NSEXPERIMENTERPHOTO
See Also:
Constant Field Values
Constructor Detail

AdminImpl

public AdminImpl(ome.util.SqlAction sql,
                 SessionFactory osf,
                 org.springframework.mail.MailSender mailSender,
                 org.springframework.mail.SimpleMailMessage templateMessage,
                 ACLVoter aclVoter,
                 PasswordProvider passwordProvider,
                 RoleProvider roleProvider,
                 LdapImpl ldapUtil,
                 PasswordUtil passwordUtil)
Method Detail

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext ctx)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException

getServiceInterface

public Class<? extends ServiceInterface> getServiceInterface()
Specified by:
getServiceInterface in interface SelfConfigurableService

userProxy

public ome.model.meta.Experimenter userProxy(Long id)
Description copied from interface: LocalAdmin
returns a possibly uninitialized proxy for the given user id. Use of the Experimenter instance will initial its values.

Specified by:
userProxy in interface LocalAdmin

userProxy

public ome.model.meta.Experimenter userProxy(String omeName)
Description copied from interface: LocalAdmin
returns a possibly uninitialized proxy for the given user name. Use of the Experimenter instance will initial its values.

Specified by:
userProxy in interface LocalAdmin

groupProxy

public ome.model.meta.ExperimenterGroup groupProxy(Long id)
Description copied from interface: LocalAdmin
returns a possibly uninitialized proxy for the given group id. Use of the Experimenter instance will initial its values.

Specified by:
groupProxy in interface LocalAdmin

groupProxy

public ome.model.meta.ExperimenterGroup groupProxy(String groupName)
Description copied from interface: LocalAdmin
returns a possibly uninitialized proxy for the given group name. Use of the Experimenter instance will initial its values.

Specified by:
groupProxy in interface LocalAdmin

getLeaderOfGroupIds

public List<Long> getLeaderOfGroupIds(ome.model.meta.Experimenter e)
Description copied from interface: IAdmin
Finds the ids for all groups for which the given Experimenter is owner/leader.

Specified by:
getLeaderOfGroupIds in interface IAdmin
Parameters:
e - Non-null, managed (i.e. with id) Experimenter
See Also:
ExperimenterGroup.getDetails(), Details.getOwner()

getMemberOfGroupIds

public List<Long> getMemberOfGroupIds(ome.model.meta.Experimenter e)
Description copied from interface: IAdmin
Finds the ids for all groups for which the given Experimenter is a member.

Specified by:
getMemberOfGroupIds in interface IAdmin
Parameters:
e - Non-null, managed (i.e. with id) Experimenter
See Also:
ExperimenterGroup.getDetails(), Details.getOwner()

getUserRoles

public List<String> getUserRoles(ome.model.meta.Experimenter e)
Description copied from interface: LocalAdmin
Finds the group names for all groups for which the given Experimenter is a member.

Specified by:
getUserRoles in interface LocalAdmin
Parameters:
e - Non-null, managed (i.e. with id) Experimenter
See Also:
ExperimenterGroup.getDetails(), Details.getOwner()

canUpdate

public boolean canUpdate(ome.model.IObject obj)
Description copied from interface: IAdmin
Returns true if the currently logged in user can modify the given IObject. This uses the same logic that would be applied during a Hibernate flush to the database.

Specified by:
canUpdate in interface IAdmin

getExperimenter

public ome.model.meta.Experimenter getExperimenter(long id)
Description copied from interface: IAdmin
fetch an Experimenter and all related groups.

Specified by:
getExperimenter in interface IAdmin
Parameters:
id - id of the Experimenter
Returns:
an Experimenter. Never null.

lookupExperimenter

public ome.model.meta.Experimenter lookupExperimenter(String omeName)
Description copied from interface: IAdmin
look up an Experimenter and all related groups by name.

Specified by:
lookupExperimenter in interface IAdmin
Parameters:
omeName - Name of the Experimenter
Returns:
an Experimenter. Never null.

lookupExperimenters

public List<ome.model.meta.Experimenter> lookupExperimenters()
Description copied from interface: IAdmin
Looks up all experimenters present and all related groups.

Specified by:
lookupExperimenters in interface IAdmin
Returns:
all Experimenters. Never null.

lookupLdapAuthExperimenters

public List<Map<String,Object>> lookupLdapAuthExperimenters()
Description copied from interface: IAdmin
Looks up all id of experimenters who uses LDAP authentication (has set dn on password table).

Specified by:
lookupLdapAuthExperimenters in interface IAdmin
Returns:
list of Experimenters. Never null.

lookupLdapAuthExperimenter

public String lookupLdapAuthExperimenter(long id)
Description copied from interface: IAdmin
Looks up experimenters who uses LDAP authentication (has set dn on password table).

Specified by:
lookupLdapAuthExperimenter in interface IAdmin
Returns:
Experimenter. Never null.

getGroup

public ome.model.meta.ExperimenterGroup getGroup(long id)
Description copied from interface: IAdmin
fetch an ExperimenterGroup and all contained users.

Specified by:
getGroup in interface IAdmin
Parameters:
id - id of the ExperimenterGroup
Returns:
an ExperimenterGroup. Never null.

lookupGroup

public ome.model.meta.ExperimenterGroup lookupGroup(String groupName)
Description copied from interface: IAdmin
look up an ExperimenterGroup and all contained users by name.

Specified by:
lookupGroup in interface IAdmin
Parameters:
groupName - Name of the ExperimenterGroup
Returns:
an ExperimenterGroup. Never null.

lookupGroups

public List<ome.model.meta.ExperimenterGroup> lookupGroups()
Description copied from interface: IAdmin
Looks up all groups present and all related experimenters. The experimenters' groups are also loaded.

Specified by:
lookupGroups in interface IAdmin
Returns:
all Groups. Never null.

containedExperimenters

public ome.model.meta.Experimenter[] containedExperimenters(long groupId)
Description copied from interface: IAdmin
fetch all users contained in this group. The returned users will have all fields filled in and all collections unloaded.

Specified by:
containedExperimenters in interface IAdmin
Parameters:
groupId - id of the ExperimenterGroup
Returns:
non-null array of all users in this group.

containedGroups

public ome.model.meta.ExperimenterGroup[] containedGroups(long experimenterId)
Description copied from interface: IAdmin
fetch all groups of which the given user is a member. The returned groups will have all fields filled in and all collections unloaded.

Specified by:
containedGroups in interface IAdmin
Parameters:
experimenterId - id of the Experimenter. Not null.
Returns:
non-null array of all groups for this user.

synchronizeLoginCache

@Transactional(readOnly=false)
public void synchronizeLoginCache()
Description copied from interface: IAdmin
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.

Specified by:
synchronizeLoginCache in interface IAdmin

updateSelf

@Transactional(readOnly=false)
public void updateSelf(ome.model.meta.Experimenter e)
Description copied from interface: IAdmin
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), use IAdmin.setDefaultGroup(Experimenter, ExperimenterGroup)

Specified by:
updateSelf in interface IAdmin
Parameters:
e - A data transfer object. Only the fields: firstName, middleName, lastName, email, and institution are checked. Not null.
See Also:
IAdmin.setDefaultGroup(Experimenter, ExperimenterGroup)

getMyUserPhotos

public List<ome.model.core.OriginalFile> getMyUserPhotos()
Description copied from interface: IAdmin
Retrieve the OriginalFile objectd attached to this user as specified by {@link #uploadMyUserPhoto(String, String, byte[]). The return value is order by the most recently modified file first.

Specified by:
getMyUserPhotos in interface IAdmin
Returns:
file objects. Possibly empty.

uploadMyUserPhoto

@Transactional(readOnly=false)
public long uploadMyUserPhoto(String filename,
                                            String mimetype,
                                            byte[] data)
Description copied from interface: IAdmin
Uploads a photo for the user which will be displayed on his/her profile. This photo will be saved as an OriginalFile object with the given format, and attached to the user's Experimenter object via an FileAnnotation with the namespace: "openmicroscopy.org/omero/experimenter/photo" (NSEXPERIMENTERPHOTO). If such an OriginalFile instance 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.

Specified by:
uploadMyUserPhoto in interface IAdmin
Parameters:
filename - Not null. String name which will be used.
mimetype - 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.

updateExperimenter

@Transactional(readOnly=false)
public void updateExperimenter(ome.model.meta.Experimenter experimenter)
Description copied from interface: IAdmin
Updates an experimenter if admin or owner of group. Only string fields on the object are taken into account. Before a SecurityViolation would be thrown, however, this method will pass to IAdmin.updateSelf(Experimenter) if the current user matches the given experimenter.

Specified by:
updateExperimenter in interface IAdmin
Parameters:
experimenter - the Experimenter to update.

updateExperimenterWithPassword

@Transactional(readOnly=false)
public void updateExperimenterWithPassword(ome.model.meta.Experimenter experimenter,
                                                         String password)
Description copied from interface: IAdmin
Updates an experimenter if admin or owner of group. Only string fields on the object are taken into account.

Specified by:
updateExperimenterWithPassword in interface IAdmin
Parameters:
experimenter - the Experimenter to update.
password - Not-null. Must pass validation in the security sub-system.

updateGroup

@Transactional(readOnly=false)
public void updateGroup(ome.model.meta.ExperimenterGroup group)
Description copied from interface: IAdmin
Updates an experimenter group if admin or owner of group. Only string fields on the object are taken into account.

Specified by:
updateGroup in interface IAdmin
Parameters:
group - the ExperimenterGroup to update.

createUser

@Transactional(readOnly=false)
public long createUser(ome.model.meta.Experimenter newUser,
                                     String defaultGroup)
Description copied from interface: IAdmin
create and return a new user. This user will be created with the default group specified.

Specified by:
createUser in interface IAdmin
Parameters:
newUser - a new Experimenter instance
Returns:
id of the newly created Experimenter

createSystemUser

@Transactional(readOnly=false)
public long createSystemUser(ome.model.meta.Experimenter newSystemUser)
Description copied from interface: IAdmin
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.

Specified by:
createSystemUser in interface IAdmin
Returns:
id of the newly created Experimenter

createExperimenter

@Transactional(readOnly=false)
public long createExperimenter(ome.model.meta.Experimenter experimenter,
                                             ome.model.meta.ExperimenterGroup defaultGroup,
                                             ome.model.meta.ExperimenterGroup... otherGroups)
Description copied from interface: IAdmin
create and return a new user in the given groups.

Specified by:
createExperimenter in interface IAdmin
Parameters:
experimenter - A new Experimenter instance. Not null.
defaultGroup - Instance of ExperimenterGroup. Not null.
otherGroups - Array of ExperimenterGroup instances. Can be null.
Returns:
id of the newly created Experimenter Not null.

createExperimenterWithPassword

@Transactional(readOnly=false)
public long createExperimenterWithPassword(ome.model.meta.Experimenter experimenter,
                                                         String password,
                                                         ome.model.meta.ExperimenterGroup defaultGroup,
                                                         ome.model.meta.ExperimenterGroup... otherGroups)
Description copied from interface: IAdmin
create and return a new user in the given groups with password.

Specified by:
createExperimenterWithPassword in interface IAdmin
Parameters:
experimenter - A new Experimenter instance. Not null.
password - Not-null. Must pass validation in the security sub-system.
defaultGroup - Instance of ExperimenterGroup. Not null.
otherGroups - Array of ExperimenterGroup instances. Can be null.
Returns:
id of the newly created Experimenter Not null.

createGroup

@Transactional(readOnly=false)
public long createGroup(ome.model.meta.ExperimenterGroup group)
Description copied from interface: IAdmin
create and return a new group. The Details.setPermissions(Permissions) method should be called on the instance which is passed. The given Permissions will 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 be Permissions.USER_PRIVATE, i.e. a group in which no user can see the other group member's data.

Specified by:
createGroup in interface IAdmin
Returns:
id of the newly created ExperimenterGroup
See Also:
ticket:1434"

addGroups

@Transactional(readOnly=false)
public void addGroups(ome.model.meta.Experimenter user,
                                    ome.model.meta.ExperimenterGroup... groups)
Description copied from interface: IAdmin
adds a user to the given groups.

Specified by:
addGroups in interface IAdmin
Parameters:
user - A currently managed entity. Not null.
groups - Groups to which the user will be added. Not null.

removeGroups

@Transactional(readOnly=false)
public void removeGroups(ome.model.meta.Experimenter user,
                                       ome.model.meta.ExperimenterGroup... groups)
Description copied from interface: IAdmin
removes a user from the given groups.

Specified by:
removeGroups in interface IAdmin
Parameters:
user - A currently managed entity. Not null.
groups - Groups from which the user will be removed. Not null.

setDefaultGroup

@Transactional(readOnly=false)
public void setDefaultGroup(ome.model.meta.Experimenter user,
                                          ome.model.meta.ExperimenterGroup group)
Description copied from interface: IAdmin
sets the default group for a given user.

Specified by:
setDefaultGroup in interface IAdmin
Parameters:
user - A currently managed Experimenter. Not null.
group - The group which should be set as default group for this user. Not null.

setGroupOwner

@Transactional(readOnly=false)
public void setGroupOwner(ome.model.meta.ExperimenterGroup group,
                                        ome.model.meta.Experimenter owner)
Description copied from interface: IAdmin
adds the user to the owner list for this group. Since Beta4.2 (ticket:1434) multiple users can be the "owner" of a group.

Specified by:
setGroupOwner in interface IAdmin
Parameters:
group - A currently managed ExperimenterGroup. Not null.
owner - A currently managed Experimenter. Not null.

unsetGroupOwner

@Transactional(readOnly=false)
public void unsetGroupOwner(ome.model.meta.ExperimenterGroup group,
                                          ome.model.meta.Experimenter owner)
Description copied from interface: IAdmin
removes the user from the owner list for this group. Since Beta4.2 (ticket:1434) multiple users can be the "owner" of a group.

Specified by:
unsetGroupOwner in interface IAdmin
Parameters:
group - A currently managed ExperimenterGroup. Not null.
owner - A currently managed Experimenter. Not null.

addGroupOwners

@Transactional(readOnly=false)
public void addGroupOwners(ome.model.meta.ExperimenterGroup group,
                                         ome.model.meta.Experimenter... owner)
Description copied from interface: IAdmin
adds the given users to the owner list for this group.

Specified by:
addGroupOwners in interface IAdmin
Parameters:
group - A currently managed ExperimenterGroup. Not null.
owner - A set of currently managed Experimenters. Not null.

removeGroupOwners

@Transactional(readOnly=false)
public void removeGroupOwners(ome.model.meta.ExperimenterGroup group,
                                            ome.model.meta.Experimenter... owner)
Description copied from interface: IAdmin
removes the given users from the owner list for this group.

Specified by:
removeGroupOwners in interface IAdmin
Parameters:
group - A currently managed ExperimenterGroup. Not null.

getDefaultGroup

public ome.model.meta.ExperimenterGroup getDefaultGroup(long experimenterId)
Description copied from interface: IAdmin
retrieve the default group for the given user id.

Specified by:
getDefaultGroup in interface IAdmin
Parameters:
experimenterId - of the Experimenter. Not null.
Returns:
non-null ExperimenterGroup. If no default group is found, an exception will be thrown.

deleteExperimenter

@Transactional(readOnly=false)
public void deleteExperimenter(ome.model.meta.Experimenter user)
Description copied from interface: IAdmin
removes a user by removing the password information for that user as well as all GroupExperimenterMap instances.

Specified by:
deleteExperimenter in interface IAdmin
Parameters:
user - Experimenter to be deleted. Not null.

deleteGroup

@Transactional(readOnly=false)
public void deleteGroup(ome.model.meta.ExperimenterGroup group)
Description copied from interface: IAdmin
removes a group by first removing all users in the group, and then deleting the actual ExperimenterGroup instance.

Specified by:
deleteGroup in interface IAdmin
Parameters:
group - ExperimenterGroup to be deleted. Not null.

changeOwner

@Transactional(readOnly=false)
public void changeOwner(ome.model.IObject iObject,
                                      String omeName)
Description copied from interface: IAdmin
call details.setOwner() on this instance. It is valid for the instance to be unloaded (or constructed with an unloading-constructor.)

Specified by:
changeOwner in interface IAdmin
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

@Transactional(readOnly=false)
public void changeGroup(ome.model.IObject iObject,
                                      String groupName)
Description copied from interface: IAdmin
call details.setGroup() on this instance. It is valid for the instance to be unloaded (or constructed with an unloading-constructor.)

Specified by:
changeGroup in interface IAdmin
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

@Transactional(readOnly=false)
public void changePermissions(ome.model.IObject iObject,
                                            ome.model.internal.Permissions perms)
the implementation of this method is somewhat tricky in that Permissions changes must be allowed even when other updates are not. Therefore, we must manually check if the object belongs to this user or is admin (before the call to SecuritySystem.runAsAdmin(AdminAction) This logic is duplicated in BasicSecuritySystem.checkManagedDetails(IObject, ome.model.internal.Details). As of OMERO 4.2 (ticket:1434), this method has special handling for an instance of ExperimenterGroup and limited capabilities for changing any other object type (ticket:1776). For groups, the permission changes will be propagated to all the contained objects. For other objects, changes may not override group settings.

Specified by:
changePermissions in interface IAdmin
Parameters:
iObject - An entity or an unloaded reference to an entity. Not null.
perms - The permissions value for this entity. Not null.
See Also:
IAdmin.changePermissions(IObject, Permissions), ticket:293, ticket:1434

moveToCommonSpace

@Transactional(readOnly=false)
public void moveToCommonSpace(ome.model.IObject... iObjects)
Description copied from interface: IAdmin
Moves the given objects into the "user" group to make them visible and linkable from all security contexts.

Specified by:
moveToCommonSpace in interface IAdmin
See Also:
ticket:1794

getLockingIds

public Map<String,Long> getLockingIds(ome.model.IObject object)
Description copied from interface: LocalAdmin
Returns a map from Class (as string) to a count for all entities which point to the given IObject. The String "*" is mapped to the sum of all the locks. TODO This will eventually return a list of ids

Specified by:
getLockingIds in interface LocalAdmin

getLockingIds

public Map<String,Long> getLockingIds(ome.model.IObject object,
                                      Long groupId)

reportForgottenPassword

@Transactional(readOnly=false)
public void reportForgottenPassword(String name,
                                                  String email)
                             throws ome.conditions.AuthenticationException
Description copied from interface: IAdmin
Can be used after repeated AuthenticationException instances 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. Does not require a session to be active.

Specified by:
reportForgottenPassword in interface IAdmin
Throws:
ome.conditions.AuthenticationException - when name and email do not match

changeExpiredCredentials

@Transactional(readOnly=false)
public void changeExpiredCredentials(String name,
                                                   String oldCred,
                                                   String newCred)
                              throws ome.conditions.AuthenticationException
Description copied from interface: IAdmin
Used after an ExpiredCredentialsException instance is thrown. Does not require

Specified by:
changeExpiredCredentials in interface IAdmin
Throws:
ome.conditions.AuthenticationException

changePassword

@Transactional(readOnly=false)
public void changePassword(String newPassword)
Description copied from interface: IAdmin
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 IAdmin.changePasswordWithOldPassword(String, String).

Specified by:
changePassword in interface IAdmin
Parameters:
newPassword - Possibly null to allow logging in with no password.
See Also:
ticket:911, ticket:3201

changePasswordWithOldPassword

@Transactional(readOnly=false)
public void changePasswordWithOldPassword(String oldPassword,
                                                        String newPassword)
Description copied from interface: IAdmin
change the password for the current user by passing the old password.

Specified by:
changePasswordWithOldPassword in interface IAdmin
newPassword - Not-null. Must pass validation in the security sub-system.

changeUserPassword

@Transactional(readOnly=false)
public void changeUserPassword(String user,
                                             String newPassword)
Description copied from interface: IAdmin
change the password for the a given user.

Specified by:
changeUserPassword in interface IAdmin
newPassword - Not-null. Might must pass validation in the security sub-system.

checkPassword

public boolean checkPassword(String name,
                             String password,
                             boolean readOnly)
If ldap plugin turned, creates Ldap accounts and authentication by LDAP available.

Specified by:
checkPassword in interface LocalAdmin
See Also:
ticket:4626

getSecurityRoles

public Roles getSecurityRoles()
Description copied from interface: IAdmin
returns the active Roles in use by the server.

Specified by:
getSecurityRoles in interface IAdmin
Returns:
Non-null, immutable Roles instance.

getEventContext

public EventContext getEventContext()
Description copied from interface: IAdmin
returns an implementation of EventContext loaded with the security for the current user and thread. If called remotely, not all values of EventContext will be sensible.

Specified by:
getEventContext in interface IAdmin
Returns:
Non-null, immutable EventContext instance

assertManaged

protected void assertManaged(ome.model.IObject o)


OmeroJava Api

Version: 4.3.4-dbcbce5a-b4

Copyright © 2009 The University of Dundee. All Rights Reserved.