Skip to content

Commit

Permalink
[#3012] Add authorized field to user model
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Nov 9, 2012
1 parent 430ba1d commit a57a751
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ckan/migration/versions/062_dg_auth.py
@@ -0,0 +1,24 @@
from migrate import *

def upgrade(migrate_engine):

update_schema = '''
BEGIN;
ALTER TABLE "user"
ADD COLUMN authorized boolean DEFAULT FALSE;
COMMIT;
'''
migrate_engine.execute(update_schema)


# authorize any sysadmins
import ckan.model as model
sysadmins = model.Session.query(model.SystemRole).filter_by(role=model.Role.ADMIN)
for sysadmin in sysadmins:

user = model.User.get(sysadmin.user.id)
user.authorized = True
model.Session.commit()
1 change: 1 addition & 0 deletions ckan/model/user.py
Expand Up @@ -24,6 +24,7 @@
Column('reset_key', types.UnicodeText),
Column('about', types.UnicodeText),
Column('sysadmin', types.Boolean, default=False),
Column('authorized', types.Boolean, default=False),
)


Expand Down

0 comments on commit a57a751

Please sign in to comment.