Opened 14 years ago
Last modified 14 years ago
#87 closed defect (FIXED)
Ability to create users from command line
Reported by: | Christopher Allan Webber | Owned by: | Alejandro Villanueva |
---|---|---|---|
Priority: | minor | Milestone: | 0.0.3 |
Component: | programming | Keywords: | |
Cc: | Parent Tickets: |
Description
A script like: :: ./bin/gmg adduser <username> <password> <email> is clearly needed. We could also use: :: ./bin/gmg makeadmin <username> ./bin/gmg changepw <username> for making an existing user an admin or changing a user's password.
Attachments (3)
Change History (15)
by , 14 years ago
Attachment: | patch.tar.gz added |
---|
comment:1 by , 14 years ago
Just implement CLI support to add users, it does NOT validate the email, and the connection is hardcoded i couldn't find the way to create the conn from the app\_config. Usage: ./bin/gmg adduser -u ialex -p secretword -m `admin@ialex.org <mailto:admin@ialex.org>`_ The user doesn't need verification after created.
comment:2 by , 14 years ago
Status: | New → In Progress |
---|
Hey, thanks for this patch(es)! Yeah the config stuff / setting up a connection is going to be refactored soon and is currently a mess. I'll look at merging this shortly. I've added you to the hackers/reporters lists in redmine.
by , 14 years ago
Attachment: | 0003-Add-changepw-and-makeadmin-to-gmg-commands.patch.tar.gz added |
---|
0003-Add-changepw-and-makeadmin-to-gmg-commands.patch.tar.gz
comment:3 by , 14 years ago
I added the another two commands mentioned on the feature, now we can change passwords and make admin to already registeres users. usage: ./bin/gmg makeadmin-u username usage: ./bin/gmg changepw -u username -p new\_password need some testing to see if everything works fine at least for me it does, and change the database stuff mentioned earlier.
comment:4 by , 14 years ago
First of all, sorry that it's taken me so long to comment on this. Second, thanks for all the work you've done on this... you got all three commands, nice! That said, I'm hoping you can make a few adjustments before I merge this. - Try and make sure your code is PEP-8 compliant. `http://www.python.org/dev/peps/pep-0008/ <http://www.python.org/dev/peps/pep-0008/>`_ ... in pacticular: - Avoid going over 80 characters (right now it's just your comments that have done this, so please wrap them) - when doing an if statement, no need to do "if (foo bar):"... in python "if foo bar:" more appropriate - Put two newlines between your functions - Pull the connection information out of the config. Yeah, okay, not your fault, and you already acknowledged this :). Here's how to do it: Look at the way that gmg\_commands/shell.py does it: :: from mediagoblin import mg_globals from mediagoblin.gmg_commands import util as commands_util def shell_parser_setup(subparser): subparser.add_argument( '-cf', '--conf_file', default='mediagoblin.ini', help="Config file used to set up environment") [...] def shell(args): """ Setup a shell for the user """ mgoblin_app = commands_util.setup_app(args) ... After you do this, you'll have access to the database through "mg\_globals.database". Looking good though! Add this stuff in another patch and I think we can probably merge this. If you don't have time / can't do this, let us know. Otherwise looking forward to seeing that patch!
comment:5 by , 14 years ago
It's Monday and its time to work, will work on that today i will put everything on a branch since im tired of patches haha, i'll send the corrections greetz
comment:6 by , 14 years ago
Component: | → Programming |
---|---|
Milestone: | → 0.0.3 |
Owner: | set to |
Wonderful! I prefer patches also. I've assigned this to you and targeting to 0.0.3 because that looks likely and reasonable now.
by , 14 years ago
Attachment: | 0002-Adding-new-function-to-gmg_commands-adduser-makeadmi.patch.tar.gz added |
---|
0002-Adding-new-function-to-gmg_commands-adduser-makeadmi.patch.tar.gz
comment:7 by , 14 years ago
Component: | → Programming |
---|---|
Milestone: | → 0.0.3 |
Owner: | set to |
here is the patch, made changes to be pep8 compatible, and change the database stuff.
comment:8 by , 14 years ago
Component: | → Programming |
---|---|
Owner: | set to |
comment:8 by , 14 years ago
Looking! Btw, I said "I prefer patches also" and meant "I prefer branches also", so if you'd rather work in branches from now on please, by all means ;)
comment:9 by , 14 years ago
Milestone: | → 0.0.3 |
---|
Merged! I also made a bit of a change and made the arguments positional instead. Thanks for your work on this Alejandro, wonderful job!
comment:11 by , 13 years ago
The original url for this bug was http://bugs.foocorp.net/issues/373 .
Relations:
#88: blocks
Note:
See TracTickets
for help on using tickets.
patch.tar.gz