Activate user via ishell?

David Fisher's Avatar

David Fisher

09 Nov, 2016 06:29 PM

Hi,

Is there a way to activate new users via ishell? And for that matter, is there a comprehensive doc for the ishell API? Would be great to know the range of commands and functions that can be manipulated that way.

Thanks,
David

  1. Support Staff 1 Posted by Marcin Kuzminsk... on 09 Nov, 2016 06:34 PM

    Marcin Kuzminski's Avatar

    Hi David,

    Ishell is a python console that works based on the RhodeCode source code. There's no way to document that. The functionality is limitless. We usually not encourage people to use this, since it's very low-level interface. We usually only recommend using it when any other methods fail.

    We have few example in docs like, lost password recovery etc.

    May i know what's your use case for activating/deactivating users via ishell, and not using our API for example ?

    Best,

  2. 2 Posted by David Fisher on 09 Nov, 2016 06:48 PM

    David Fisher's Avatar

    Thanks for the quick response Marcin!

    We downgraded from Enterprise to Community and I seem to have been locked out. We had LDAP auth set up on the previous instance, but I can't log in at all right now using my regular username (getting both invalid username AND invalid password message). But if I try to create a user with my username, the UI tells me the user already exists. I've requested a pw change via the UI but don't receive an email. And I changed the password manually with ishell but still am unable to log in.

    So I thought I'd try to create a temporary user via the UI, elevate privileges to admin via ishell, and log in as that user so I could at least get into the UI as an Admin. But the new user still requires activation and I can't get in via the UI to do that. So I thought there might be a way via ishell to activate a user. My network admin is out today and I need to get RC going for the rest of our team in the mean time.

    I don't have UI access and hence can't get an API key to interact that way.

    Thanks for any help you can provide.

    David

  3. Support Staff 3 Posted by Marcin Kuzminsk... on 09 Nov, 2016 07:14 PM

    Marcin Kuzminski's Avatar

    Hi David,

    please join our slack channel i might able to help you out there faster.
    https://rhodecode.com/join.

    Ping @admin once you're there.

  4. Support Staff 4 Posted by Marcin Kuzminsk... on 09 Nov, 2016 07:46 PM

    Marcin Kuzminski's Avatar

    David,

    In any case here's generally how to do it:

    user = User.get_by_username("yournewuser")
    user.active = True
    user.admit = True
    Session().add(user);Session().commit()

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac