[ckan-changes] [okfn/ckan] 7c60ba: [#1163] Users can be deleted
GitHub
noreply at github.com
Sun Aug 18 13:24:16 UTC 2013
Branch: refs/heads/1178-users-invitations
Home: https://github.com/okfn/ckan
Commit: 7c60ba441dcbdb309e82344a6a981b87243a20a3
https://github.com/okfn/ckan/commit/7c60ba441dcbdb309e82344a6a981b87243a20a3
Author: Vitor Baptista <vitor at vitorbaptista.com>
Date: 2013-08-16 (Fri, 16 Aug 2013)
Changed paths:
M ckan/config/routing.py
M ckan/controllers/user.py
M ckan/lib/authenticator.py
M ckan/lib/base.py
M ckan/lib/create_test_data.py
M ckan/logic/action/delete.py
M ckan/logic/action/get.py
M ckan/logic/auth/delete.py
A ckan/migration/versions/070_add_state_column_to_user_table.py
M ckan/model/follower.py
M ckan/model/user.py
M ckan/new_authz.py
M ckan/templates/user/edit_user_form.html
M ckan/templates/user/read_base.html
M ckan/tests/functional/test_user.py
A ckan/tests/lib/test_authenticator.py
M ckan/tests/lib/test_dictization.py
M ckan/tests/logic/test_action.py
M ckan/tests/logic/test_auth.py
A ckan/tests/models/test_follower.py
M ckan/tests/models/test_user.py
Log Message:
-----------
[#1163] Users can be deleted
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.
Commit: ad2de00a4e2c2772d1e59faee26ca818731168c9
https://github.com/okfn/ckan/commit/ad2de00a4e2c2772d1e59faee26ca818731168c9
Author: Vitor Baptista <vitor at vitorbaptista.com>
Date: 2013-08-16 (Fri, 16 Aug 2013)
Changed paths:
M ckan/logic/action/get.py
M ckan/migration/versions/070_add_state_column_to_user_table.py
M ckan/model/follower.py
M ckan/model/group.py
M ckan/model/user.py
Log Message:
-----------
[#1163] Use ckan.model.State instead of vdm.sqlalchemy.State
This makes us a bit less tied to vdm.
Commit: d6fde48e5cd73a2d0754b3ceb9fe6319deedaa20
https://github.com/okfn/ckan/commit/d6fde48e5cd73a2d0754b3ceb9fe6319deedaa20
Author: Vitor Baptista <vitor at vitorbaptista.com>
Date: 2013-08-16 (Fri, 16 Aug 2013)
Changed paths:
M ckan/logic/action/get.py
M ckan/migration/versions/070_add_state_column_to_user_table.py
M ckan/model/follower.py
M ckan/model/group.py
M ckan/model/user.py
Log Message:
-----------
[#1163] Use ckan.model.core.State instead of ckan.model.State
With this change, we're able to avoid having to load ckan.model inside methods,
to avoid circular dependencies.
Commit: 89a38101afe7b1415d431cdffc013e45bf90bf67
https://github.com/okfn/ckan/commit/89a38101afe7b1415d431cdffc013e45bf90bf67
Author: Vitor Baptista <vitor at vitorbaptista.com>
Date: 2013-08-16 (Fri, 16 Aug 2013)
Changed paths:
M ckan/lib/authenticator.py
M ckan/lib/base.py
M ckan/model/user.py
M ckan/new_authz.py
M ckan/tests/lib/test_authenticator.py
M ckan/tests/logic/test_auth.py
M ckan/tests/models/test_user.py
Log Message:
-----------
[#1178] Add PENDING state to User
Commit: c0c6803b574d48016af6185fd0a2a71605567a77
https://github.com/okfn/ckan/commit/c0c6803b574d48016af6185fd0a2a71605567a77
Author: Vitor Baptista <vitor at vitorbaptista.com>
Date: 2013-08-16 (Fri, 16 Aug 2013)
Changed paths:
M ckan/controllers/user.py
M ckan/tests/functional/test_user.py
Log Message:
-----------
[#1178] The user is activated when it performs the reset password
Commit: 74f649c9e3eb0690f5e48f939b4546b415b0777b
https://github.com/okfn/ckan/commit/74f649c9e3eb0690f5e48f939b4546b415b0777b
Author: Vitor Baptista <vitor at vitorbaptista.com>
Date: 2013-08-16 (Fri, 16 Aug 2013)
Changed paths:
M ckan/controllers/user.py
M ckan/logic/action/create.py
M ckan/logic/auth/create.py
M ckan/logic/schema.py
M ckan/new_authz.py
M ckan/tests/functional/test_user.py
M ckan/tests/logic/test_action.py
M ckan/tests/logic/test_auth.py
M dev-requirements.txt
Log Message:
-----------
[#1178] Admins can invite users
The invited user starts in pending state, with the password reset key set. We
still have to send an email to the user telling him/her to change the password
and log in.
I had to change authorization code to only automatically unauthorize deleted
users, not pending. This was because the users needs to be able to perform the
password reset when pending, to be able to become active.
Commit: 31523cd27a35958c2f0660a2762bcfd0274c8006
https://github.com/okfn/ckan/commit/31523cd27a35958c2f0660a2762bcfd0274c8006
Author: Vitor Baptista <vitor at vitorbaptista.com>
Date: 2013-08-16 (Fri, 16 Aug 2013)
Changed paths:
M ckan/controllers/user.py
Log Message:
-----------
[#1178] perform_reset uses the received id as the context's user
When performing a password reset, the user is probably (always?) not logged in.
So c.user is an empty string. So, the auth functions have no way to tell which
user is trying to reset his/her password.
This worked fine before, because everyone was able to reset the password. But
now that we've got users in DELETED state, it's not the case anymore.
Commit: e5890740164c38ca0ebf10bf25a297b0b634e204
https://github.com/okfn/ckan/commit/e5890740164c38ca0ebf10bf25a297b0b634e204
Author: Vitor Baptista <vitor at vitorbaptista.com>
Date: 2013-08-16 (Fri, 16 Aug 2013)
Changed paths:
M ckan/lib/mailer.py
M ckan/logic/action/create.py
M ckan/tests/lib/test_mailer.py
M ckan/tests/logic/test_action.py
Log Message:
-----------
[#1178] Send email to the invited user
I removed the time.sleep(0.1) on TestMailer. Looking through the code, I
couldn't find anywhere where a timer looked needed. And I ran these tests a
hundred times without the timer to see if I could make them fail, but no. So, I
guess they're not needed anymore.
I also had to move the RESET_LINK_MESSAGE inside get_reset_link_body(). This
was because, when importing ckan.lib.mailer in ckan.logic.action.create.py, I
got:
TypeError: No object (name: translator) has been registered for this thread
This seems to be because we were using _() before pylons had a change to set up
the translator. Moving it inside the method solves this.
Compare: https://github.com/okfn/ckan/compare/2c76ed3bd7bc...e5890740164c
More information about the ckan-changes
mailing list