@Transactional(readOnly=true) public class AdminImpl extends AbstractLevel2Service implements LocalAdmin, org.springframework.context.ApplicationContextAware
SecuritySystem
,
Permissions
Modifier and Type | Field and Description |
---|---|
protected ACLVoter |
aclVoter |
protected LightAdminPrivileges |
adminPrivileges |
protected ChmodStrategy |
chmod |
protected ome.system.OmeroContext |
context |
protected ome.util.checksum.ChecksumProviderFactory |
cpf |
protected LdapImpl |
ldapUtil |
protected org.springframework.mail.MailSender |
mailSender |
protected static java.lang.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 |
iQuery, iUpdate, metadata, queryFactory, readOnlyStatus, sec
Constructor and Description |
---|
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,
ChmodStrategy chmod,
ome.util.checksum.ChecksumProviderFactory cpf,
LightAdminPrivileges adminPrivileges) |
Modifier and Type | Method and Description |
---|---|
void |
addGroupOwners(ome.model.meta.ExperimenterGroup group,
ome.model.meta.Experimenter... owner) |
void |
addGroups(ome.model.meta.Experimenter user,
ome.model.meta.ExperimenterGroup... groups) |
protected void |
assertManaged(ome.model.IObject o) |
boolean |
canAnnotate(ome.model.IObject obj)
Companion to
IAdmin.canUpdate(IObject) but not yet remotely
accessible. |
boolean |
canUpdate(ome.model.IObject obj) |
void |
changeExpiredCredentials(java.lang.String name,
java.lang.String oldCred,
java.lang.String newCred) |
void |
changeGroup(ome.model.IObject iObject,
java.lang.String groupName) |
void |
changeOwner(ome.model.IObject iObject,
java.lang.String omeName) |
void |
changePassword(java.lang.String newPassword) |
void |
changePasswordWithOldPassword(java.lang.String oldPassword,
java.lang.String newPassword) |
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(java.lang.String user,
java.lang.String newPassword) |
boolean |
checkPassword(java.lang.String name,
java.lang.String password,
boolean readOnly)
If ldap plugin turned, creates Ldap accounts and authentication by LDAP
available.
|
ome.model.meta.Experimenter[] |
containedExperimenters(long groupId) |
ome.model.meta.ExperimenterGroup[] |
containedGroups(long experimenterId) |
long |
createExperimenter(ome.model.meta.Experimenter experimenter,
ome.model.meta.ExperimenterGroup defaultGroup,
ome.model.meta.ExperimenterGroup... otherGroups) |
long |
createExperimenterWithPassword(ome.model.meta.Experimenter experimenter,
java.lang.String password,
ome.model.meta.ExperimenterGroup defaultGroup,
ome.model.meta.ExperimenterGroup... otherGroups) |
long |
createGroup(ome.model.meta.ExperimenterGroup group) |
long |
createRestrictedSystemUser(ome.model.meta.Experimenter newSystemUser,
java.util.List<ome.model.enums.AdminPrivilege> privileges) |
long |
createRestrictedSystemUserWithPassword(ome.model.meta.Experimenter newSystemUser,
java.util.List<ome.model.enums.AdminPrivilege> privileges,
java.lang.String password) |
long |
createSystemUser(ome.model.meta.Experimenter newSystemUser) |
long |
createUser(ome.model.meta.Experimenter newUser,
java.lang.String defaultGroup) |
void |
deleteExperimenter(ome.model.meta.Experimenter user) |
void |
deleteGroup(ome.model.meta.ExperimenterGroup group) |
java.util.List<ome.model.enums.AdminPrivilege> |
getAdminPrivileges(ome.model.meta.Experimenter user) |
java.util.List<ome.model.meta.Experimenter> |
getAdminsWithPrivileges(java.util.List<ome.model.enums.AdminPrivilege> privileges) |
java.util.List<ome.model.enums.AdminPrivilege> |
getCurrentAdminPrivileges() |
ome.model.meta.ExperimenterGroup |
getDefaultGroup(long experimenterId) |
ome.system.EventContext |
getEventContext() |
ome.system.EventContext |
getEventContextQuiet()
Like
IAdmin.getEventContext() but will not reload the context. |
ome.model.meta.Experimenter |
getExperimenter(long id) |
ome.model.meta.ExperimenterGroup |
getGroup(long id) |
java.util.List<java.lang.Long> |
getLeaderOfGroupIds(ome.model.meta.Experimenter e) |
java.util.Map<java.lang.String,java.lang.Long> |
getLockingIds(java.lang.Class<ome.model.IObject> type,
long id,
java.lang.Long groupId)
Returns a map from
Class (as string) to a count for all entities
which point to the given IObject . |
java.util.Map<java.lang.String,java.lang.Long> |
getLockingIds(ome.model.IObject object) |
java.util.List<java.lang.Long> |
getMemberOfGroupIds(ome.model.meta.Experimenter e) |
java.util.List<ome.model.core.OriginalFile> |
getMyUserPhotos() |
ome.system.Roles |
getSecurityRoles() |
java.lang.Class<? extends ome.api.ServiceInterface> |
getServiceInterface() |
java.util.List<java.lang.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(java.lang.Long id)
returns a possibly uninitialized proxy for the given
group id . |
ome.model.meta.ExperimenterGroup |
groupProxy(java.lang.String groupName)
returns a possibly uninitialized proxy for the given
group name . |
void |
internalMoveToCommonSpace(ome.model.IObject obj)
Helpers which unconditionally moves the object to the common space.
|
ome.model.meta.Experimenter |
lookupExperimenter(java.lang.String omeName) |
java.util.List<ome.model.meta.Experimenter> |
lookupExperimenters() |
ome.model.meta.ExperimenterGroup |
lookupGroup(java.lang.String groupName) |
java.util.List<ome.model.meta.ExperimenterGroup> |
lookupGroups() |
java.lang.String |
lookupLdapAuthExperimenter(long id) |
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
lookupLdapAuthExperimenters() |
void |
moveToCommonSpace(ome.model.IObject... iObjects) |
void |
removeGroupOwners(ome.model.meta.ExperimenterGroup group,
ome.model.meta.Experimenter... owner) |
void |
removeGroups(ome.model.meta.Experimenter user,
ome.model.meta.ExperimenterGroup... groups) |
void |
reportForgottenPassword(java.lang.String name,
java.lang.String email) |
void |
setAdminPrivileges(ome.model.meta.Experimenter user,
java.util.List<ome.model.enums.AdminPrivilege> privileges) |
void |
setApplicationContext(org.springframework.context.ApplicationContext ctx) |
void |
setDefaultGroup(ome.model.meta.Experimenter user,
ome.model.meta.ExperimenterGroup group) |
void |
setGroupOwner(ome.model.meta.ExperimenterGroup group,
ome.model.meta.Experimenter owner) |
void |
synchronizeLoginCache() |
void |
unsetGroupOwner(ome.model.meta.ExperimenterGroup group,
ome.model.meta.Experimenter owner) |
void |
updateExperimenter(ome.model.meta.Experimenter experimenter) |
void |
updateExperimenterWithPassword(ome.model.meta.Experimenter experimenter,
java.lang.String password) |
void |
updateGroup(ome.model.meta.ExperimenterGroup group) |
void |
updateSelf(ome.model.meta.Experimenter e) |
long |
uploadMyUserPhoto(java.lang.String filename,
java.lang.String mimetype,
byte[] data) |
ome.model.meta.Experimenter |
userProxy(java.lang.Long id)
returns a possibly uninitialized proxy for the given
user id . |
ome.model.meta.Experimenter |
userProxy(java.lang.String omeName)
returns a possibly uninitialized proxy for the given
user name . |
getBeanHelper, getExtendedMetadata, getQueryFactory, getSecuritySystem, selfConfigure, setExtendedMetadata, setQueryFactory, setQueryService, setReadOnlyStatus, setSecuritySystem, setUpdateService
protected final ome.util.SqlAction sql
protected final SessionFactory osf
protected final org.springframework.mail.MailSender mailSender
protected final org.springframework.mail.SimpleMailMessage templateMessage
protected final ACLVoter aclVoter
protected final PasswordProvider passwordProvider
protected final RoleProvider roleProvider
protected final PasswordUtil passwordUtil
protected final LdapImpl ldapUtil
protected final ChmodStrategy chmod
protected final ome.util.checksum.ChecksumProviderFactory cpf
protected final LightAdminPrivileges adminPrivileges
protected ome.system.OmeroContext context
protected static final java.lang.String NSEXPERIMENTERPHOTO
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, ChmodStrategy chmod, ome.util.checksum.ChecksumProviderFactory cpf, LightAdminPrivileges adminPrivileges)
public void setApplicationContext(org.springframework.context.ApplicationContext ctx) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
public java.lang.Class<? extends ome.api.ServiceInterface> getServiceInterface()
getServiceInterface
in interface ome.system.SelfConfigurableService
public ome.model.meta.Experimenter userProxy(java.lang.Long id)
LocalAdmin
user id
. Use of the Experimenter
instance will initialize its values.userProxy
in interface LocalAdmin
id
- the ID of a userpublic ome.model.meta.Experimenter userProxy(java.lang.String omeName)
LocalAdmin
user name
. Use of the
Experimenter
instance will initialize its values.userProxy
in interface LocalAdmin
omeName
- the name of a userpublic ome.model.meta.ExperimenterGroup groupProxy(java.lang.Long id)
LocalAdmin
group id
. Use of the
Experimenter
instance will initialize its values.groupProxy
in interface LocalAdmin
id
- the ID of a grouppublic ome.model.meta.ExperimenterGroup groupProxy(java.lang.String groupName)
LocalAdmin
group name
. Use of the
Experimenter
instance will initialize its values.groupProxy
in interface LocalAdmin
groupName
- the name of a grouppublic java.util.List<java.lang.Long> getLeaderOfGroupIds(ome.model.meta.Experimenter e)
getLeaderOfGroupIds
in interface ome.api.IAdmin
public java.util.List<java.lang.Long> getMemberOfGroupIds(ome.model.meta.Experimenter e)
getMemberOfGroupIds
in interface ome.api.IAdmin
public java.util.List<java.lang.String> getUserRoles(ome.model.meta.Experimenter e)
LocalAdmin
Experimenter
is
a member.getUserRoles
in interface LocalAdmin
e
- Non-null, managed (i.e. with id) Experimenter
ExperimenterGroup.getDetails()
,
Details.getOwner()
public boolean canAnnotate(ome.model.IObject obj)
LocalAdmin
IAdmin.canUpdate(IObject)
but not yet remotely
accessible.canAnnotate
in interface LocalAdmin
obj
- Not null.public boolean canUpdate(ome.model.IObject obj)
canUpdate
in interface ome.api.IAdmin
public ome.model.meta.Experimenter getExperimenter(long id)
getExperimenter
in interface ome.api.IAdmin
public ome.model.meta.Experimenter lookupExperimenter(java.lang.String omeName)
lookupExperimenter
in interface ome.api.IAdmin
public java.util.List<ome.model.meta.Experimenter> lookupExperimenters()
lookupExperimenters
in interface ome.api.IAdmin
public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> lookupLdapAuthExperimenters()
lookupLdapAuthExperimenters
in interface ome.api.IAdmin
public java.lang.String lookupLdapAuthExperimenter(long id)
lookupLdapAuthExperimenter
in interface ome.api.IAdmin
public ome.model.meta.ExperimenterGroup getGroup(long id)
getGroup
in interface ome.api.IAdmin
public ome.model.meta.ExperimenterGroup lookupGroup(java.lang.String groupName)
lookupGroup
in interface ome.api.IAdmin
public java.util.List<ome.model.meta.ExperimenterGroup> lookupGroups()
lookupGroups
in interface ome.api.IAdmin
public ome.model.meta.Experimenter[] containedExperimenters(long groupId)
containedExperimenters
in interface ome.api.IAdmin
public ome.model.meta.ExperimenterGroup[] containedGroups(long experimenterId)
containedGroups
in interface ome.api.IAdmin
@Transactional(readOnly=false) public void synchronizeLoginCache()
synchronizeLoginCache
in interface ome.api.IAdmin
@Transactional(readOnly=false) public void updateSelf(ome.model.meta.Experimenter e)
updateSelf
in interface ome.api.IAdmin
public java.util.List<ome.model.core.OriginalFile> getMyUserPhotos()
getMyUserPhotos
in interface ome.api.IAdmin
@Transactional(readOnly=false) public long uploadMyUserPhoto(java.lang.String filename, java.lang.String mimetype, byte[] data)
uploadMyUserPhoto
in interface ome.api.IAdmin
@Transactional(readOnly=false) public void updateExperimenter(ome.model.meta.Experimenter experimenter)
updateExperimenter
in interface ome.api.IAdmin
@Transactional(readOnly=false) public void updateExperimenterWithPassword(ome.model.meta.Experimenter experimenter, java.lang.String password)
updateExperimenterWithPassword
in interface ome.api.IAdmin
@Transactional(readOnly=false) public void updateGroup(ome.model.meta.ExperimenterGroup group)
updateGroup
in interface ome.api.IAdmin
@Transactional(readOnly=false) public long createUser(ome.model.meta.Experimenter newUser, java.lang.String defaultGroup)
createUser
in interface ome.api.IAdmin
@Transactional(readOnly=false) public long createSystemUser(ome.model.meta.Experimenter newSystemUser)
createSystemUser
in interface ome.api.IAdmin
@Transactional(readOnly=false) public long createRestrictedSystemUser(ome.model.meta.Experimenter newSystemUser, java.util.List<ome.model.enums.AdminPrivilege> privileges)
createRestrictedSystemUser
in interface ome.api.IAdmin
@Transactional(readOnly=false) public long createRestrictedSystemUserWithPassword(ome.model.meta.Experimenter newSystemUser, java.util.List<ome.model.enums.AdminPrivilege> privileges, java.lang.String password)
createRestrictedSystemUserWithPassword
in interface ome.api.IAdmin
@Transactional(readOnly=false) public long createExperimenter(ome.model.meta.Experimenter experimenter, ome.model.meta.ExperimenterGroup defaultGroup, ome.model.meta.ExperimenterGroup... otherGroups)
createExperimenter
in interface ome.api.IAdmin
@Transactional(readOnly=false) public long createExperimenterWithPassword(ome.model.meta.Experimenter experimenter, java.lang.String password, ome.model.meta.ExperimenterGroup defaultGroup, ome.model.meta.ExperimenterGroup... otherGroups)
createExperimenterWithPassword
in interface ome.api.IAdmin
@Transactional(readOnly=false) public long createGroup(ome.model.meta.ExperimenterGroup group)
createGroup
in interface ome.api.IAdmin
@Transactional(readOnly=false) public void addGroups(ome.model.meta.Experimenter user, ome.model.meta.ExperimenterGroup... groups)
addGroups
in interface ome.api.IAdmin
@Transactional(readOnly=false) public void removeGroups(ome.model.meta.Experimenter user, ome.model.meta.ExperimenterGroup... groups)
removeGroups
in interface ome.api.IAdmin
@Transactional(readOnly=false) public void setDefaultGroup(ome.model.meta.Experimenter user, ome.model.meta.ExperimenterGroup group)
setDefaultGroup
in interface ome.api.IAdmin
@Transactional(readOnly=false) public void setGroupOwner(ome.model.meta.ExperimenterGroup group, ome.model.meta.Experimenter owner)
setGroupOwner
in interface ome.api.IAdmin
@Transactional(readOnly=false) public void unsetGroupOwner(ome.model.meta.ExperimenterGroup group, ome.model.meta.Experimenter owner)
unsetGroupOwner
in interface ome.api.IAdmin
@Transactional(readOnly=false) public void addGroupOwners(ome.model.meta.ExperimenterGroup group, ome.model.meta.Experimenter... owner)
addGroupOwners
in interface ome.api.IAdmin
@Transactional(readOnly=false) public void removeGroupOwners(ome.model.meta.ExperimenterGroup group, ome.model.meta.Experimenter... owner)
removeGroupOwners
in interface ome.api.IAdmin
public ome.model.meta.ExperimenterGroup getDefaultGroup(long experimenterId)
getDefaultGroup
in interface ome.api.IAdmin
@Transactional(readOnly=false) public void deleteExperimenter(ome.model.meta.Experimenter user)
deleteExperimenter
in interface ome.api.IAdmin
@Transactional(readOnly=false) public void deleteGroup(ome.model.meta.ExperimenterGroup group)
deleteGroup
in interface ome.api.IAdmin
@Transactional(readOnly=false) public void changeOwner(ome.model.IObject iObject, java.lang.String omeName)
changeOwner
in interface ome.api.IAdmin
@Transactional(readOnly=false) public void changeGroup(ome.model.IObject iObject, java.lang.String groupName)
changeGroup
in interface ome.api.IAdmin
@Transactional(readOnly=false) public void changePermissions(ome.model.IObject iObject, ome.model.internal.Permissions perms)
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.changePermissions
in interface ome.api.IAdmin
IAdmin.changePermissions(IObject, Permissions)
,
ticket:293,
ticket:1434@Transactional(readOnly=false) public void moveToCommonSpace(ome.model.IObject... iObjects)
moveToCommonSpace
in interface ome.api.IAdmin
public void internalMoveToCommonSpace(ome.model.IObject obj)
uploadMyUserPhoto(String, String, byte[])
internalMoveToCommonSpace
in interface LocalAdmin
obj
- a model object, linked to the current session; never null
public java.util.Map<java.lang.String,java.lang.Long> getLockingIds(ome.model.IObject object)
public java.util.Map<java.lang.String,java.lang.Long> getLockingIds(java.lang.Class<ome.model.IObject> type, long id, java.lang.Long groupId)
LocalAdmin
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.getLockingIds
in interface LocalAdmin
type
- the name of a model classid
- the ID of an instance of klass
groupId
- the ID of a group to omit from the results, may be null
@Transactional(readOnly=false) public void reportForgottenPassword(java.lang.String name, java.lang.String email) throws ome.conditions.AuthenticationException
reportForgottenPassword
in interface ome.api.IAdmin
ome.conditions.AuthenticationException
@Transactional(readOnly=false) public void changeExpiredCredentials(java.lang.String name, java.lang.String oldCred, java.lang.String newCred) throws ome.conditions.AuthenticationException
changeExpiredCredentials
in interface ome.api.IAdmin
ome.conditions.AuthenticationException
@Transactional(readOnly=false) public void changePassword(java.lang.String newPassword)
changePassword
in interface ome.api.IAdmin
@Transactional(readOnly=false) public void changePasswordWithOldPassword(java.lang.String oldPassword, java.lang.String newPassword)
changePasswordWithOldPassword
in interface ome.api.IAdmin
@Transactional(readOnly=false) public void changeUserPassword(java.lang.String user, java.lang.String newPassword)
changeUserPassword
in interface ome.api.IAdmin
public boolean checkPassword(java.lang.String name, java.lang.String password, boolean readOnly)
checkPassword
in interface LocalAdmin
name
- the name of a userpassword
- the user's passwordreadOnly
- if the password check should be transactionally read-onlypublic java.util.List<ome.model.meta.Experimenter> getAdminsWithPrivileges(java.util.List<ome.model.enums.AdminPrivilege> privileges)
getAdminsWithPrivileges
in interface ome.api.IAdmin
public java.util.List<ome.model.enums.AdminPrivilege> getCurrentAdminPrivileges()
getCurrentAdminPrivileges
in interface ome.api.IAdmin
public java.util.List<ome.model.enums.AdminPrivilege> getAdminPrivileges(ome.model.meta.Experimenter user)
getAdminPrivileges
in interface ome.api.IAdmin
@Transactional(readOnly=false) public void setAdminPrivileges(ome.model.meta.Experimenter user, java.util.List<ome.model.enums.AdminPrivilege> privileges)
setAdminPrivileges
in interface ome.api.IAdmin
public ome.system.Roles getSecurityRoles()
getSecurityRoles
in interface ome.api.IAdmin
public ome.system.EventContext getEventContext()
getEventContext
in interface ome.api.IAdmin
public ome.system.EventContext getEventContextQuiet()
LocalAdmin
IAdmin.getEventContext()
but will not reload the context.
This also has the result that values from the current call context
will be applied as simply the session context.getEventContextQuiet
in interface LocalAdmin
protected void assertManaged(ome.model.IObject o)