ome / omero-py

Python project containing Ice remoting code for OMERO
https://www.openmicroscopy.org/omero
GNU General Public License v2.0
20 stars 33 forks source link

How to activate experimenter with the omero-py admin service #420

Open ArtemLogachov opened 1 month ago

ArtemLogachov commented 1 month ago

Hi, I use this code to create an Experimenter

exp = ExperimenterI()
exp.omeName = rstring(username)
exp.firstName = rstring(first_name if first_name else "")
exp.lastName = rstring(last_name if last_name else "")
exp.email = rstring(email if email else "")
exp.ldap = rbool(False)  # Set LDAP to False

group_name = "name"
group_obj = admin_service.lookupGroup(group_name)

default_group = ExperimenterGroupI(group_obj.id.val, False)
groups = [default_group]

# Save the experimenter
exp = admin_service.createExperimenterWithPassword(
    exp, rstring(password), default_group, groups
)
return exp

But after creating an experimenter it set active flag to false and user can not login to the OMERO admin

Is there any way on how I can make this user active with the admin service?

Thanks

will-moore commented 1 month ago

You need to add the user to the user group:

groups = [default_group]
groups.append(admin_service.lookupGroup('user'))
ArtemLogachov commented 1 month ago

Thanks for the fast answer! It helped