Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
To do this, I've configured the User model to be stateful using vdm.sqlalchemy. Right now, there're two states: active and deleted. If a user is deleted, he can't login, and is unauthorized to do anything. She also doesn't appear in the user's list anymore, but you can still access her profile page, if you know her username. If she was logged in when her user was deleted, the next time she goes into CKAN, she'll be logged off. Unfortunately, there's not a useful message like "Your user has been deleted." Yet. There's no way to undelete a user, but it should be simply creating an action to set her state to active.
- Loading branch information
1 parent
01a3c05
commit 7c60ba4
Showing
21 changed files
with
527 additions
and
147 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
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
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
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
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
17 changes: 17 additions & 0 deletions
17
ckan/migration/versions/070_add_state_column_to_user_table.py
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import vdm.sqlalchemy | ||
|
||
|
||
def upgrade(migrate_engine): | ||
migrate_engine.execute( | ||
''' | ||
ALTER TABLE "user" ADD COLUMN "state" text NOT NULL DEFAULT '%s' | ||
''' % vdm.sqlalchemy.State.ACTIVE | ||
) | ||
|
||
|
||
def downgrade(migrate_engine): | ||
migrate_engine.exeecute( | ||
''' | ||
ALTER TABLE "user" DROP COLUMN "state" | ||
''' | ||
) |
Oops, something went wrong.