Generating initial roles and resetting admin password etc

61 views
Skip to first unread message

Rasjid Wilcox

unread,
Sep 18, 2013, 7:34:12 AM9/18/13
to cork-d...@googlegroups.com
Hi all,

Working through setting up Cork in my project, and looking at the 'recreate_example_conf.py' example, it seems that the code for setting up the initial roles and admin user is done at a fairly low level.

What do people think of having a paramater to the Cork class - called 'force_admin_override' or perhaps 'use_dummy_admin' or something like that?  With that passed in as a paramater, all future checks for the current user would return that they are an admin, and so we can just use the standard calls.

So initialisation would become:

cork = Cork('example_conf', initialize=True, force_admin_override=True)
cork.create_role('admin', 100)
cork.create_role('editor', 60)
cork.create_role('user', 50)
cork.create_user('admin_user', 'admin', admin_pass)

What do people think?  I'm happy to work this through and submit patches (or pull request) once done.

Cheers,

Rasjid.

Federico Ceratto

unread,
Sep 27, 2013, 6:01:32 AM9/27/13
to cork-d...@googlegroups.com
Hello Rasjid,

I assume that most developers would initialize the database using some scripts (usually with a deployment tool), however it could be handy to set up the database with a simple command - especially for testing.
I see a security risk in having a "god-mode" flag in the library: people could inadvertently leave it and deploy their code in production.
What about having a command-line tool to perform the db initialization?

(This could be moved into a GitHub Issue)

Bye,

Federico



--
You received this message because you are subscribed to the Google Groups "cork-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cork-discuss...@googlegroups.com.
To post to this group, send an email to cork-d...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/cork-discuss/430ef9e0-15a7-4602-83dd-90eeddefdbe2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Federico

Rasjid Wilcox

unread,
Oct 6, 2013, 9:19:56 AM10/6/13
to cork-d...@googlegroups.com
Hi Federico,

Yes, I think you are right about the 'god mode' issue.

I think a separate module (cork.sysadmin perhaps), which could either be imported or used as a command line tool might be a good approach.

Cheers,

Rasjid.
Reply all
Reply to author
Forward
0 new messages