Package omeroweb :: Package webclient :: Module webclient_gateway :: Class OmeroWebGateway
[hide private]
[frames] | no frames]

Class OmeroWebGateway

source code


Instance Methods [hide private]
 
__init__(self, *args, **kwargs)
Create the connection wrapper.
source code
 
connect(self, *args, **kwargs)
Creates or retrieves connection for the given sessionUuid and removes some groups from the event context Returns True if connected.
source code
 
attachToShare(self, share_id)
Turns on the access control lists attached to the given share for the current session.
source code
Long
getShareId(self)
Returns active share id .
source code
 
removeGroupFromContext(self)
Removes group "User" from the current context.
source code
 
changeActiveGroup(self, gid)
Every time session is created default group becomes active group and is loaded with the security for the current user and thread.
source code
 
isForgottenPasswordSet(self)
Retrieves a configuration value "omero.resetpassword.config" for Forgotten password form from the backend store.
source code
 
reportForgottenPassword(self, username, email)
Allows to reset the password (temporary password is sent).
source code
 
isAnythingCreated(self)
Checks if any of the experimenter was created before
source code
 
listLdapAuthExperimenters(self)
Lists all IDs of experimenters who are authenticated by LDAP (has set dn on password table).
source code
String
getLdapAuthExperimenter(self, eid)
Return DN of the specific experimenter if uses LDAP authentication (has set dn on password table) or None.
source code
ExperimenterWrapper generator
getExperimenters(self)
Return all experimenters apart from current user.
source code
 
getServerVersion(self)
Retrieves a configuration value "omero.version" from the backend store.
source code
 
findWellInPlate(self, plate_name, row, column) source code
 
listTags(self, eid=None) source code
 
countOrphans(self, obj_type, eid=None) source code
DatasetWrapper generator
listOrphans(self, obj_type, eid=None, page=None)
List orphaned Datasets, Images, Plates controlled by the security system, Optionally filter by experimenter 'eid'
source code
ImageWrapper generator
listImagesInDataset(self, oid, eid=None, page=None)
List Images in the given Dataset.
source code
AnnotationWrapper
findTag(self, name, desc=None)
Retrieves Tag by given Name and description
source code
 
uploadMyUserPhoto(self, filename, format, data)
Uploads a photo for the user which will be displayed on his/her profile.
source code
 
hasExperimenterPhoto(self, oid=None)
Check if File annotation with the namespace: "openmicroscopy.org/omero/experimenter/photo" (NSEXPERIMENTERPHOTO) is linked to the given user ID.
source code
 
getExperimenterPhoto(self, oid=None)
Get File annotation with the namespace: "openmicroscopy.org/omero/experimenter/photo" (NSEXPERIMENTERPHOTO) linked to the given user ID.
source code
 
getExperimenterPhotoSize(self, oid=None)
Get size of File annotation with the namespace: "openmicroscopy.org/omero/experimenter/photo" (NSEXPERIMENTERPHOTO) linked to the given user ID.
source code
 
cropExperimenterPhoto(self, box, oid=None)
Crop File annotation with the namespace: "openmicroscopy.org/omero/experimenter/photo" (NSEXPERIMENTERPHOTO) linked to the given user ID.
source code
 
getExperimenterDefaultPhoto(self)
If file annotation with the namespace: "openmicroscopy.org/omero/experimenter/photo" (NSEXPERIMENTERPHOTO) is not linked to experimenter this method generate default picture of the person.
source code
 
getFileFormat(self, format)
Get file annotation format for the given value.
source code
 
getCollectionCount(self, parent, child, ids)
Counts the number of members in a collection for a given object.
source code
 
checkOmeName(self, ome_name, old_omeName=None) source code
 
checkGroupName(self, name, old_name=None) source code
 
checkEmail(self, email, old_email=None) source code
 
defaultThumbnail(self, size=(120,120)) source code
 
changeUserPassword(self, omeName, password, my_password)
Change the password for the a given user.
source code
 
changeMyPassword(self, password, old_password)
Change the password for the current user by passing the old password.
source code
 
createExperimenter(self, experimenter, defaultGroup, otherGroups, password)
Create and return a new user in the given groups with password.
source code
 
updateExperimenter(self, experimenter, defaultGroup, addGroups, rmGroups)
Update an existing user including groups user is a member of.
source code
 
setMembersOfGroup(self, group, add_exps, rm_exps)
Change members of the group.
source code
 
createGroup(self, group, group_owners)
Create and return a new group with the given owners.
source code
 
updateGroup(self, group, add_exps, rm_exps, perm=None)
Update an existing user including groups user is a member of.
source code
 
updateMyAccount(self, experimenter, defultGroup)
Allows a user to update his/her own information and set the default group for a given user.
source code
 
updatePermissions(self, obj, perm)
Allow to change the permission on the object.
source code
 
saveObject(self, obj)
Provide method for directly updating object graphs.
source code
 
saveArray(self, objs)
Provide method for directly updating list of object graphs.
source code
 
saveAndReturnObject(self, obj)
Provide method for directly updating object graphs and return it.
source code
 
saveAndReturnId(self, obj)
Provide method for directly updating object graphs and return ID.
source code
 
saveAndReturnFile(self, binary, oFile_id)
Provide method for directly updating a file object and return binary.
source code
ShareWrapper
getShare(self, oid)
Gets share for the given share id.
source code
ShareWrapper generator
getOwnShares(self)
Gets all owned shares for the current user.
source code
ShareWrapper generator
getMemberShares(self)
Gets all shares where current user is a member.
source code
Dict of long: long
getMemberCount(self, share_ids)
Returns a map from share id to the count of total members (including the owner).
source code
Dict of long: long
getCommentCount(self, share_ids)
Returns a map from share id to comment count.
source code
omero.gateway.BlitzObjectWrapper generator
getContents(self, share_id)
Looks up all items belonging to the share, wrapped in object wrapper
source code
AnnotationWrapper generator
getComments(self, share_id)
Looks up all comments which belong to the share, wrapped in object wrapper
source code
ExperimenterWrapper generator
getAllMembers(self, share_id)
Get all {@link Experimenter users} who are a member of the share.
source code
List of Strings
getAllGuests(self, share_id)
Get the email addresses for all share guests.
source code
List of Strings
getAllUsers(self, share_id)
Get a single set containing the login names of the users as well email addresses for guests.
source code
 
prepareRecipients(self, recipients) source code
 
addComment(self, host, blitz_id, share_id, comment) source code
 
removeImage(self, share_id, image_id) source code
 
createShare(self, host, blitz_id, image, message, members, enable, expiration=None) source code
 
updateShareOrDiscussion(self, host, blitz_id, share_id, message, add_members, rm_members, enable, expiration=None) source code
ImageWrapper generator
listLastImportedImages(self)
Retrieve most recent imported images controlled by the security system.
source code
ShareWrapper generator
listMostRecentShares(self)
Retrieve most recent shares controlled by the security system.
source code
SessionCommentWrapper generator
listMostRecentShareComments(self)
Retrieve most recent share comments controlled by the security system.
source code
BlitzObjectWrapper generator
listMostRecentComments(self)
Retrieve most recent comment annotations controlled by the security system.
source code
BlitzObjectWrapper generator
listMostRecentTags(self)
Retrieve most recent tag annotations controlled by the security system.
source code
Map
getDataByPeriod(self, start, end, eid, otype=None, page=None)
Retrieve given data objects by the given period of time controlled by the security system.
source code
Long
countDataByPeriod(self, start, end, eid, otype=None)
Counts given data objects by the given period of time controlled by the security system.
source code
List
getEventsByPeriod(self, start, end, eid)
Retrieve event log objects by the given period of time controlled by the security system.
source code

Inherited from omero.gateway._BlitzGateway: buildQuery, canBeAdmin, canWrite, clone, containedExperimenters, createEnumeration, createExporter, createFileAnnfromLocalFile, createImageFromNumpySeq, createRawFileStore, createRawPixelsStore, createRenderingEngine, createSearchService, createThumbnailStore, deleteEnumeration, deleteObjectDirect, deleteObjects, findExperimenters, getAdminService, getAnnotationLinks, getConfigService, getContainerService, getDefaultGroup, getDeleteService, getEnumeration, getEnumerationById, getEnumerationEntries, getEnumerations, getEnumerationsWithEntries, getEventContext, getFreeSpace, getGroupFromContext, getGroupsLeaderOf, getGroupsMemberOf, getLastError, getMetadataService, getObject, getObjects, getObjectsByAnnotations, getOriginalEnumerations, getOtherGroups, getPixelsService, getProperty, getQueryService, getRenderingSettingsService, getRepositoryInfoService, getRoiService, getScriptService, getSession, getSessionService, getShareService, getSharedResources, getTimelineService, getTypesService, getUpdateService, getUser, isAdmin, isAnonymous, isConnected, isOwner, isSecure, keepAlive, listColleagues, listFileAnnotations, listGroups, listOwnedGroups, listProjects, listScreens, listStaffs, resetEnumerations, revertGroupForSession, searchObjects, seppuku, setGroupForSession, setGroupNameForSession, setIdentity, setSecure, suConn, timelineListImages, updateEnumerations

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from omero.gateway._BlitzGateway: CONFIG, ICE_CONFIG

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, *args, **kwargs)
(Constructor)

source code 

Create the connection wrapper. Does not attempt to connect at this stage Initialises the omero.client

Parameters:
  • username (String) - User name. If not specified, use 'omero.gateway.anon_user'
  • passwd (String) - Password.
  • client_obj - omero.client
  • group (String) - name of group to try to connect to
  • clone (Boolean) - If True, overwrite anonymous with False
  • try_super (Boolean) - Try to log on as super user ('system' group)
  • host (String) - Omero server host.
  • port (Integer) - Omero server port.
  • extra_config (Dict) - Dictionary of extra configuration
  • secure (Boolean) - Initial underlying omero.client connection type (True=SSL/False=insecure)
  • anonymous (Boolean)
  • useragent (String) - Log which python clients use this connection. E.g. 'OMERO.webadmin'
  • _shareId (Long) - Active share ID
Overrides: object.__init__

connect(self, *args, **kwargs)

source code 

Creates or retrieves connection for the given sessionUuid and removes some groups from the event context Returns True if connected.

Parameters:
  • sUuid (omero_model_SessionI) - session uuid
Returns:
Boolean
Overrides: omero.gateway._BlitzGateway.connect

attachToShare(self, share_id)

source code 

Turns on the access control lists attached to the given share for the current session. Warning: this will slow down the execution of the current session for all database reads. Writing to the database will not be allowed. If share does not exist or is not accessible (non-members) or is disabled, then an ValidationException is thrown.

Parameters:
  • shareId (Long) - share id

getShareId(self)

source code 

Returns active share id .

Returns: Long
Share ID

changeActiveGroup(self, gid)

source code 

Every time session is created default group becomes active group and is loaded with the security for the current user and thread. Public data has to be created in the context of the group where user, who would like to look at these data, is a member of. Public data can be only visible by the member of group and owners.

Parameters:
  • gid (Long) - New active group ID
Returns:
Boolean

isForgottenPasswordSet(self)

source code 

Retrieves a configuration value "omero.resetpassword.config" for Forgotten password form from the backend store.

Returns:
Boolean

reportForgottenPassword(self, username, email)

source code 

Allows to reset the password (temporary password is sent). The given email must match the email for the user listed under the name argument.

Parameters:
  • username (String) - omename
  • email (String) - email address

isAnythingCreated(self)

source code 

Checks if any of the experimenter was created before

Returns:
Boolean

listLdapAuthExperimenters(self)

source code 

Lists all IDs of experimenters who are authenticated by LDAP
(has set dn on password table).

@return:    List of experimetner IDs
@rtype:     L{Dict of String: Long}

getLdapAuthExperimenter(self, eid)

source code 

Return DN of the specific experimenter if uses LDAP authentication (has set dn on password table) or None.

Parameters:
  • eid (Long) - experimenter ID
Returns: String
Distinguished Name

getExperimenters(self)

source code 

Return all experimenters apart from current user.

Returns: ExperimenterWrapper generator
Generator yielding experimetners list

getServerVersion(self)

source code 

Retrieves a configuration value "omero.version" from the backend store.

Returns:
String

listOrphans(self, obj_type, eid=None, page=None)

source code 

List orphaned Datasets, Images, Plates controlled by the security system, Optionally filter by experimenter 'eid'

Parameters:
  • obj_type - 'Dataset', 'Image', 'Plate'
  • eid (Long) - experimenter id
  • page (Long) - page number
Returns: DatasetWrapper generator
Generator yielding Datasets

listImagesInDataset(self, oid, eid=None, page=None)

source code 

List Images in the given Dataset. Optinally filter by experimenter 'eid'

Parameters:
  • eid (Long) - experimenter id
  • page (Long) - page number
Returns: ImageWrapper generator
Generator yielding Images

findTag(self, name, desc=None)

source code 

Retrieves Tag by given Name and description

@param name name of tag @type name String @param desc description of tag @type desc String

Returns: AnnotationWrapper
TagAnnotation

uploadMyUserPhoto(self, filename, format, data)

source code 

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 File Annotation 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.

@param filename name which will be used. @type filename String @param format Format.value string. 'image/jpeg' and 'image/png' are common values. @type format String @param data Data from the image. This will be written to disk. @type data String

@return ID of the overwritten or newly created user photo OriginalFile object. @rtype Long

hasExperimenterPhoto(self, oid=None)

source code 

Check if File annotation with the namespace: "openmicroscopy.org/omero/experimenter/photo" (NSEXPERIMENTERPHOTO) is linked to the given user ID. If user id not set, owned by the current user.

@param oid experimenter ID @type oid Long @return True or False @rtype Boolean

getExperimenterPhoto(self, oid=None)

source code 

Get File annotation with the namespace: "openmicroscopy.org/omero/experimenter/photo" (NSEXPERIMENTERPHOTO) linked to the given user ID. If user id not set, owned by the current user.

@param oid experimenter ID @type oid Long @return Data from the image. @rtype String

getExperimenterPhotoSize(self, oid=None)

source code 

Get size of File annotation with the namespace: "openmicroscopy.org/omero/experimenter/photo" (NSEXPERIMENTERPHOTO) linked to the given user ID. If user id not set, owned by the current user.

@param oid experimenter ID @type oid Long @return Tuple including dimention and size of the file @rtype Tuple

cropExperimenterPhoto(self, box, oid=None)

source code 

Crop File annotation with the namespace: "openmicroscopy.org/omero/experimenter/photo" (NSEXPERIMENTERPHOTO) linked to the given user ID. If user id not set, owned by the current user. New dimentions are defined by squer positions box = (x1,y1,x2,y2)

@param box tuple of new square positions @type box Tuple @param oid experimenter ID @type oid Long

getExperimenterDefaultPhoto(self)

source code 

If file annotation with the namespace: "openmicroscopy.org/omero/experimenter/photo" (NSEXPERIMENTERPHOTO) is not linked to experimenter this method generate default picture of the person.

@return Data from the image. @rtype String

getFileFormat(self, format)

source code 

Get file annotation format for the given value.

@return Omero File format @rtype String

getCollectionCount(self, parent, child, ids)

source code 

Counts the number of members in a collection for a given object.

@param parent       The fully-qualified classname of the object to be tested
@type parent        String
@param child        Name of the property on that class, omitting getters and setters.
@type child         String
@param ids          Set of Longs, the ids of the objects to test
@type ids           L{Long}
@return             A map from id integer to count integer
@rtype              L{(Long, Long)}

changeUserPassword(self, omeName, password, my_password)

source code 

Change the password for the a given user.

@param omeName Experimetner omename @type omeName String @param password Must pass validation in the security sub-system. @type password String @param my_password Must pass validation in the security sub-system. @type my_password String

changeMyPassword(self, password, old_password)

source code 

Change the password for the current user by passing the old password.

@param password Must pass validation in the security sub-system. @type password String @param old_password Old password @type old_password String @return None or error message if password could not be changed @rtype String

createExperimenter(self, experimenter, defaultGroup, otherGroups, password)

source code 

Create and return a new user in the given groups with password.

@param experimenter A new Experimenter instance. @type experimenter ExperimenterI @param defaultGroup Instance of ExperimenterGroup selected as a first active group. @type defaultGroup ExperimenterGroupI @param otherGroups List of ExperimenterGroup instances. Can be empty. @type otherGroups ExperimenterGroupI @param password Must pass validation in the security sub-system. @type password String @return ID of the newly created Experimenter Not null. @rtype Long

updateExperimenter(self, experimenter, defaultGroup, addGroups, rmGroups)

source code 

Update an existing user including groups user is a member of. Password cannot be changed by calling that method.

@param experimenter An existing Experimenter instance. @type experimenter ExperimenterI @param defaultGroup Instance of ExperimenterGroup selected as a new active group. @type defaultGroup ExperimenterGroupI @param addGroups List of new ExperimenterGroup instances user will be a member of. Can be empty. @type addGroups ExperimenterGroupI @param rmGroups List of old ExperimenterGroup instances user no longer be a member of. Can be empty. @type rmGroups ExperimenterGroupI

setMembersOfGroup(self, group, add_exps, rm_exps)

source code 

Change members of the group.

@param group An existing ExperimenterGroup instance. @type group ExperimenterGroupI @param add_exps List of new Experimenters instances. Can be empty. @type add_exps ExperimenterI @param rm_exps List of old Experimenters instances no longer be a member of that group. Can be empty. @type rm_exps ExperimenterI

createGroup(self, group, group_owners)

source code 

Create and return a new group with the given owners.

@param group A new ExperimenterGroup instance. @type group ExperimenterGroupI @param group_owners List of Experimenter instances. Can be empty. @type group_owners ExperimenterI @return ID of the newly created ExperimenterGroup Not null. @rtype Long

updateGroup(self, group, add_exps, rm_exps, perm=None)

source code 

Update an existing user including groups user is a member of. Password cannot be changed by calling that method.

@param group An existing ExperimenterGroup instance. @type group ExperimenterGroupI @param add_exps List of new Experimenter instances. Can be empty. @type add_exps ExperimenterI @param rm_exps List of old Experimenter instances who no longer will be a member of. Can be empty. @type rm_exps ExperimenterI @param perm Permissions set on the given group @type perm PermissionsI

updateMyAccount(self, experimenter, defultGroup)

source code 

Allows a user to update his/her own information and set the default group for a given user.
@param experimenter     A data transfer object. Only the fields: firstName, middleName, 
                        lastName, email, and institution are checked. Not null.
@type experimenter      ExperimenterI
@param defultGroup      The group which should be set as default group for this user. Not null
@type defultGroup       ExperimenterGroupI

updatePermissions(self, obj, perm)

source code 

Allow to change the permission on the object.

@param obj An entity or an unloaded reference to an entity. Not null. @type obj ObjectI @param perm The permissions value for this entity. Not null. @type perm PermissionsI

saveObject(self, obj)

source code 

Provide method for directly updating object graphs. Act recursively on the entire object graph, replacing placeholders and details where necessary, and then "merging" the final graph. This means that the objects that are passed into methods are copied over to new instances which are then returned. The original objects should be discarded.

@param obj An entity or an unloaded reference to an entity. Not null. @type obj ObjectI

saveArray(self, objs)

source code 

Provide method for directly updating list of object graphs. Act recursively on the entire object graph, replacing placeholders and details where necessary, and then "merging" the final graph. This means that the objects that are passed into methods are copied over to new instances which are then returned. The original objects should be discarded.

@param obj List of entities or an unloaded references to an entity. Not null. @type obj ObjectI

saveAndReturnObject(self, obj)

source code 

Provide method for directly updating object graphs and return it. Act recursively on the entire object graph, replacing placeholders and details where necessary, and then "merging" the final graph. This means that the objects that are passed into methods are copied over to new instances which are then returned. The original objects should be discarded.

@param obj An entity or an unloaded reference to an entity. Not null. @type obj ObjectI @return Saved object @rtype ObjectI

saveAndReturnId(self, obj)

source code 

Provide method for directly updating object graphs and return ID. Act recursively on the entire object graph, replacing placeholders and details where necessary, and then "merging" the final graph. This means that the objects that are passed into methods are copied over to new instances which are then returned. The original objects should be discarded.

@param obj An entity or an unloaded reference to an entity. Not null. @type obj ObjectI @return ID of saved object @rtype Long

saveAndReturnFile(self, binary, oFile_id)

source code 

Provide method for directly updating a file object and return binary.

@param binary Binary. Not null. @type binary String @param oFile_id File Id in order to manage the state of the service. Not null. @type oFile_id Long @return Shallow copy of file.

getShare(self, oid)

source code 

Gets share for the given share id.

Parameters:
  • oid (Long) - Share ID.
Returns: ShareWrapper
ShareWrapper or None

getOwnShares(self)

source code 

Gets all owned shares for the current user.

Returns: ShareWrapper generator
Shares that user owns

getMemberShares(self)

source code 

Gets all shares where current user is a member.

Returns: ShareWrapper generator
Shares that user is a member of

getMemberCount(self, share_ids)

source code 

Returns a map from share id to the count of total members (including the owner). This is represented by ome.model.meta.ShareMember links.

Parameters:
  • share_ids (List of Longs) - List of IDs
Returns: Dict of long: long
Dict of shareId: member-count

getCommentCount(self, share_ids)

source code 

Returns a map from share id to comment count.

Parameters:
  • share_ids (List of Longs) - List of IDs
Returns: Dict of long: long
Dict of shareId: comment-count

getContents(self, share_id)

source code 

Looks up all items belonging to the share, wrapped in object wrapper

Parameters:
  • share_id (Long) - share ID
Returns: omero.gateway.BlitzObjectWrapper generator
Share contents

getComments(self, share_id)

source code 

Looks up all comments which belong to the share, wrapped in object wrapper

Parameters:
  • share_id (Long) - share ID
Returns: AnnotationWrapper generator
Share comments

getAllMembers(self, share_id)

source code 

Get all {@link Experimenter users} who are a member of the share.

Parameters:
  • share_id (Long) - share ID
Returns: ExperimenterWrapper generator
Members of share

getAllGuests(self, share_id)

source code 

Get the email addresses for all share guests.

Parameters:
  • share_id (Long) - share ID
Returns: List of Strings
List of e-mail addresses

getAllUsers(self, share_id)

source code 

Get a single set containing the login names of the users as well email addresses for guests.

Parameters:
  • share_id (Long) - share ID
Returns: List of Strings
List of usernames and e-mail addresses

listLastImportedImages(self)

source code 

Retrieve most recent imported images controlled by the security system.

Returns: ImageWrapper generator
Generator yielding Images

listMostRecentShares(self)

source code 

Retrieve most recent shares controlled by the security system.

Returns: ShareWrapper generator
Generator yielding SessionAnnotationLink

listMostRecentShareComments(self)

source code 

Retrieve most recent share comments controlled by the security system.

Returns: SessionCommentWrapper generator
Generator yielding SessionAnnotationLink

listMostRecentComments(self)

source code 

Retrieve most recent comment annotations controlled by the security system.

Returns: BlitzObjectWrapper generator
Generator yielding BlitzObjectWrapper

listMostRecentTags(self)

source code 

Retrieve most recent tag annotations controlled by the security system.

Returns: BlitzObjectWrapper generator
Generator yielding BlitzObjectWrapper

getDataByPeriod(self, start, end, eid, otype=None, page=None)

source code 

Retrieve given data objects by the given period of time controlled by the security system.

@param start Starting data @type start Long @param end Finishing data @type end Long

Parameters:
  • otype, Data, type - Project, Dataset, Image @type otype String
Returns: Map
Map of project, dataset and image lists

countDataByPeriod(self, start, end, eid, otype=None)

source code 

Counts given data objects by the given period of time controlled by the security system.

@param start Starting data @type start Long @param end Finishing data @type end Long

Parameters:
  • otype, Data, type - Project, Dataset, Image @type otype String
Returns: Long
Counter

getEventsByPeriod(self, start, end, eid)

source code 

Retrieve event log objects by the given period of time controlled by the security system.

@param start Starting data @type start Long @param end Finishing data @type end Long

Returns: List
List of event logs