def setUp(self): # read-only users & data def ReadOnly(key, admin=False, groupowner=False): dbhelpers.USERS["read_only_%s" % key] = dbhelpers.UserEntry( "r-_%s" % key, "ome", firstname="chmod", lastname="test", groupname="ReadOnly_chmod_test", groupperms=READONLY, groupowner=groupowner, admin=admin, ) ReadOnly("owner") ReadOnly("user") ReadOnly("admin", admin=True) ReadOnly("leader", groupowner=True) dbhelpers.PROJECTS["read_only_proj"] = dbhelpers.ProjectEntry("read_only_proj", "read_only_owner") dbhelpers.PROJECTS["read_only_proj_2"] = dbhelpers.ProjectEntry("read_only_proj_2", "read_only_owner") # read-annotate users & data def ReadAnn(key, admin=False, groupowner=False): dbhelpers.USERS["read_ann_%s" % key] = dbhelpers.UserEntry( "ra_%s" % key, "ome", firstname="chmod", lastname="test", groupname="ReadAnn_chmod_test", groupperms=READANN, groupowner=groupowner, admin=admin, ) ReadAnn("owner") ReadAnn("user") ReadAnn("admin", admin=True) ReadAnn("leader", groupowner=True) dbhelpers.PROJECTS["read_ann_proj"] = dbhelpers.ProjectEntry("read_ann_proj", "read_ann_owner") # read-write users & data def ReadWrite(key, admin=False, groupowner=False): dbhelpers.USERS["read_write_%s" % key] = dbhelpers.UserEntry( "rw_%s" % key, "ome", firstname="chmod", lastname="test", groupname="ReadWrite_chmod_test", groupperms=READWRITE, groupowner=groupowner, admin=admin, ) ReadWrite("owner") ReadWrite("user") ReadWrite("admin", admin=True) ReadWrite("leader", groupowner=True) dbhelpers.PROJECTS["read_write_proj"] = dbhelpers.ProjectEntry("read_write_proj", "read_write_owner") dbhelpers.bootstrap()
def testReadOnly(self, gatewaywrapper): """ In a read-only group, user should NOT be able to Edit or Annotate """ dbhelpers.USERS['read_only_owner'] = dbhelpers.UserEntry( 'r-_owner', 'ome', firstname='chmod', lastname='test', groupname="ReadOnly_chmod_test", groupperms=READONLY) dbhelpers.USERS['read_only_user'] = dbhelpers.UserEntry( 'r-_user', 'ome', firstname='chmod2', lastname='test', groupname="ReadOnly_chmod_test", groupperms=READONLY) dbhelpers.bootstrap(onlyUsers=True) # Login as owner... gatewaywrapper.doLogin(dbhelpers.USERS['read_only_owner']) p = omero.model.ProjectI() p.setName(rstring("test_create_read_only_project")) p = gatewaywrapper.gateway.getUpdateService().saveAndReturnObject(p) # Login as user... gatewaywrapper.doLogin(dbhelpers.USERS['read_only_user']) project = gatewaywrapper.gateway.getObject("Project", p.id.val) self.assertCanEdit(project, False) self.assertCanAnnotate(project, False)
def setUp(self): """ Create a group with User """ dbhelpers.USERS['history_test_user'] = dbhelpers.UserEntry( 'history_test_user', 'ome', firstname='history', lastname='user', groupname="rw_history", groupperms=READWRITE) dbhelpers.bootstrap(onlyUsers=True)
def setUp(self): # read-only users & data def ReadOnly(key, admin=False, groupowner=False): dbhelpers.USERS['read_only_%s' % key] = dbhelpers.UserEntry( "r-_%s" % key, 'ome', firstname='chmod', lastname='test', groupname="ReadOnly_chmod_test", groupperms=READONLY, groupowner=groupowner, admin=admin) ReadOnly('owner') ReadOnly('user') ReadOnly('admin', admin=True) ReadOnly('leader', groupowner=True) dbhelpers.PROJECTS['read_only_proj'] = dbhelpers.ProjectEntry( 'read_only_proj', 'read_only_owner') dbhelpers.PROJECTS['read_only_proj_2'] = dbhelpers.ProjectEntry( 'read_only_proj_2', 'read_only_owner') # read-annotate users & data def ReadAnn(key, admin=False, groupowner=False): dbhelpers.USERS['read_ann_%s' % key] = dbhelpers.UserEntry( "ra_%s" % key, 'ome', firstname='chmod', lastname='test', groupname="ReadAnn_chmod_test", groupperms=READANN, groupowner=groupowner, admin=admin) ReadAnn('owner') ReadAnn('user') ReadAnn('admin', admin=True) ReadAnn('leader', groupowner=True) dbhelpers.PROJECTS['read_ann_proj'] = dbhelpers.ProjectEntry( 'read_ann_proj', 'read_ann_owner') # read-write users & data def ReadWrite(key, admin=False, groupowner=False): dbhelpers.USERS['read_write_%s' % key] = dbhelpers.UserEntry( "rw_%s" % key, 'ome', firstname='chmod', lastname='test', groupname="ReadWrite_chmod_test", groupperms=READWRITE, groupowner=groupowner, admin=admin) ReadWrite('owner') ReadWrite('user') ReadWrite('admin', admin=True) ReadWrite('leader', groupowner=True) dbhelpers.PROJECTS['read_write_proj'] = dbhelpers.ProjectEntry( 'read_write_proj', 'read_write_owner') dbhelpers.bootstrap()
def setUp(self): """ Create a group with owner & member""" dbhelpers.USERS['group_owner'] = dbhelpers.UserEntry( 'group_owner', 'ome', firstname='Group', lastname='Owner', groupname="ownership_test", groupperms='rwr---', groupowner=True) dbhelpers.USERS['group_member'] = dbhelpers.UserEntry( 'group_member', 'ome', firstname='Group', lastname='Member', groupname="ownership_test", groupperms='rwr---', groupowner=False) dbhelpers.bootstrap(onlyUsers=True)
def setUp(self): """ Create a group with Admin & Owner members""" # readonly with an Admin user dbhelpers.USERS['chmod_group_admin'] = dbhelpers.UserEntry( 'r-_chmod_admin', 'ome', firstname='chmod', lastname='admin', groupname="ReadOnly_chmod_group", groupperms=READONLY, admin=True) dbhelpers.USERS['chmod_group_owner'] = dbhelpers.UserEntry( 'r-_chmod_owner', 'ome', firstname='chmod', lastname='owner', groupname="ReadOnly_chmod_group", groupperms=READONLY, groupowner=True) dbhelpers.bootstrap(onlyUsers=True)
def setUp(self): """ Create a group with Admin & Owner members""" # readonly with an Admin user dbhelpers.USERS["chmod_group_admin"] = dbhelpers.UserEntry( "r-_chmod_admin", "ome", firstname="chmod", lastname="admin", groupname="ReadOnly_chmod_group", groupperms=READONLY, admin=True, ) dbhelpers.USERS["chmod_group_owner"] = dbhelpers.UserEntry( "r-_chmod_owner", "ome", firstname="chmod", lastname="owner", groupname="ReadOnly_chmod_group", groupperms=READONLY, groupowner=True, ) dbhelpers.bootstrap(onlyUsers=True)
def testReadOnly(self, gatewaywrapper): """ In a read-only group, user should NOT be able to Edit or Annotate """ dbhelpers.USERS["read_only_owner"] = dbhelpers.UserEntry( "r-_owner", "ome", firstname="chmod", lastname="test", groupname="ReadOnly_chmod_test", groupperms=READONLY ) dbhelpers.USERS["read_only_user"] = dbhelpers.UserEntry( "r-_user", "ome", firstname="chmod2", lastname="test", groupname="ReadOnly_chmod_test", groupperms=READONLY ) dbhelpers.bootstrap(onlyUsers=True) # Login as owner... gatewaywrapper.doLogin(dbhelpers.USERS["read_only_owner"]) p = omero.model.ProjectI() p.setName(rstring("test_create_read_only_project")) p = gatewaywrapper.gateway.getUpdateService().saveAndReturnObject(p) # Login as user... gatewaywrapper.doLogin(dbhelpers.USERS["read_only_user"]) project = gatewaywrapper.gateway.getObject("Project", p.id.val) self.assertCanEdit(project, False) self.assertCanAnnotate(project, False)
def prepTestDB(self, onlyUsers=False, skipImages=True): dbhelpers.bootstrap(onlyUsers=onlyUsers, skipImages=skipImages)
def prepTestDB (self, onlyUsers=False): dbhelpers.bootstrap(onlyUsers=onlyUsers)
def prepTestDB(self, onlyUsers=False): dbhelpers.bootstrap(onlyUsers=onlyUsers)
def prepTestDB(self): dbhelpers.bootstrap()