forked from anusharanganathan/RDFDatabank
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Edited the function to add users from the command line to work with s…
…qlalchemy Removed lxml from requries.txt as it throws errors when setting up the app Removed users.py from app_globals Modified auth_entry to handle super user
- Loading branch information
Anusha Ranganathan
committed
Apr 14, 2012
1 parent
8c8a74c
commit a41f574
Showing
4 changed files
with
65 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,34 @@ | ||
import sqlalchemy as sa | ||
from rdfdatabank.model import init_model | ||
from rdfdatabank.lib.auth_entry import add_user, add_user_groups | ||
import sys | ||
import ConfigParser | ||
import sys, os | ||
|
||
if __name__ == "__main__": | ||
username = sys.argv[1] | ||
password = sys.argv[2] | ||
email = sys.argv[3] | ||
user_details = { | ||
#Initialize sqlalchemy | ||
c = ConfigParser.ConfigParser() | ||
f = '/var/lib/databank/production.ini' | ||
c.read(f) | ||
if not os.path.exists(f): | ||
print "Config file not found" | ||
elif not 'app:main' in c.sections(): | ||
print "Section app:main not found in config file" | ||
else: | ||
engine = sa.create_engine(c.get('app:main', 'sqlalchemy.url')) | ||
init_model(engine) | ||
#add user | ||
username = sys.argv[1] | ||
password = sys.argv[2] | ||
email = sys.argv[3] | ||
user_details = { | ||
'username':u'%s'%username, | ||
'password':u"%s"%password, | ||
'name':u'Databank Administrator', | ||
'email':u"%s"%email | ||
} | ||
add_user(user_details) | ||
|
||
groups = [] | ||
groups.append(('*', 'administrator')) | ||
add_user_groups(groups) | ||
} | ||
add_user(user_details) | ||
#Add user membership | ||
groups = [] | ||
groups.append(('*', 'administrator')) | ||
add_user_groups(username, groups) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,5 @@ redis | |
repoze.who>=2.0a4 | ||
repoze.who_friendlyform | ||
solrpy | ||
lxml | ||
rdflib==2.4.2 | ||
python-dateutil>=1.4.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters