-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/fixcosmosdb #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
68704e9
a45a6c0
ad4dee9
5c419d4
81527b9
362de0b
ad63848
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| In no particular order... | ||
|
|
||
| Ada Taylor '16 | ||
| Luke O'Malley '14 | ||
| Lars Johnson '15 | ||
| Allen Park '15 | ||
| Amol Bhave '17 | ||
| Tim Wilczynski '14 | ||
| Jesse Orlowski '16 | ||
| Cosmos Darwin '15 | ||
| Will Oursler '15 | ||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import base64 | ||
| import pbkdf2 | ||
| import os | ||
| import json | ||
|
|
||
| from db import * | ||
|
|
||
| # TODO: init_users | ||
| # TODO init_groups | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know it doesn't matter, but the blatent inconsistency in formatting here makes me sad. |
||
|
|
||
| user_db = init('user') | ||
| user = user_db.query(User).get( 'admin' ) | ||
| if user: | ||
| exit() # TODO: Shouldn't exit because other stuff runs below. | ||
| newuser = User() | ||
| newuser.username = 'admin' | ||
| newuser.salt = base64.b64encode( os.urandom(128) ) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Generating a salted hash strikes me as something that can go in utils, although I'm not sure how often it'd be used.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will be mostly removed once we have SRP; but if it stays around, I'll probalby move most of this code into an auth submodule (there are going to be submodules for each identity provider). I dont think salted hashes have use outside of authentication, so I don't think it's appropriate to treat this as a first class utility. |
||
| newuser.passhash = pbkdf2.PBKDF2( 'password', newuser.salt ).hexread(32) | ||
| user_db.add( newuser ) | ||
| user_db.commit() | ||
|
|
||
| group_db = init('group') | ||
| group = group_db.query(Group).get( 'accounts-admin' ) | ||
| if group: | ||
| exit() | ||
| newgroup = Group() | ||
| newgroup.groupname = 'accounts-admin' | ||
| newgroup.owner = 'accounts-admin' | ||
| newgroup.immediate_members = json.dumps(['admin']) | ||
| newgroup.subgroups = json.dumps([]) | ||
| group_db.add( newgroup ) | ||
| group_db.commit() | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like alphabetical order for my arbitrary orderings.