-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
526 additions
and
420 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 |
---|---|---|
|
@@ -156,6 +156,19 @@ The latest application build can be built and run using Docker for testing purpo | |
All Flask command-line tools are accessed by optional input argument to the container, e.g. | ||
``flask shell -> docker run -it ...ahl/auth shell``, ``flask db -> docker run -it ...ahl/auth db``. | ||
|
||
Docker images built by Jenkins can be tried out locally by executing the following steps :: | ||
|
||
docker run -itp 5000:5000 --rm --name xl_auth mblomdahl/xl_auth:next | ||
# Above command does not detach, so, in another terminal: | ||
docker exec -it xl_auth /usr/local/bin/flask create_user -e [email protected] -p 1234 --force \ | ||
--is-admin --is-active | ||
# Now open localhost:5000 in the browser and login as [email protected] | ||
|
||
|
||
To import users, collections and permissions into the Docker container, run :: | ||
|
||
docker exec -it xl_auth /usr/local/bin/flask import_data [email protected] | ||
|
||
|
||
Project Notes | ||
============= | ||
|
@@ -182,6 +195,17 @@ DB Models | |
Changelog | ||
========= | ||
|
||
v. 0.7.2 | ||
-------- | ||
|
||
* Added support for creating new users directly from register/edit permission views | ||
(`#140 <https://github.com/libris/xl_auth/issues/140>`_) | ||
* UX enhancements (`#142 <https://github.com/libris/xl_auth/issues/142>`_, | ||
`#133 <https://github.com/libris/xl_auth/issues/133>`_) | ||
* Link to Permissions' overview removed from navbar | ||
* Ignoring/discarding permissions on inactive collections | ||
|
||
|
||
v. 0.7.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
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,9 @@ | |
from jinja2 import escape | ||
|
||
from xl_auth.permission.models import Permission | ||
from xl_auth.user.models import User | ||
|
||
from ..factories import CollectionFactory, PermissionFactory, UserFactory | ||
from ..factories import CollectionFactory, PermissionFactory | ||
|
||
|
||
def test_superuser_can_edit_existing_permission(superuser, permission, testapp): | ||
|
@@ -24,8 +25,9 @@ def test_superuser_can_edit_existing_permission(superuser, permission, testapp): | |
form['password'] = 'myPrecious' | ||
# Submits | ||
res = form.submit().follow() | ||
# Clicks Permissions button | ||
res = res.click(_('Permissions')) | ||
assert res.status_code == 200 | ||
# Goes to Permissions' overview | ||
res = testapp.get(url_for('permission.home')) | ||
# Clicks Edit button on a permission | ||
res = res.click(href=url_for('permission.edit', permission_id=permission.id)) | ||
# Fills out the form | ||
|
@@ -92,7 +94,6 @@ def test_cataloging_admin_can_edit_permission_from_user_view(user, permission, s | |
PermissionFactory(user=user, collection=permission.collection, | ||
cataloging_admin=True).save_as(superuser) | ||
initial_permission_user_id = permission.user.id | ||
other_user = UserFactory().save_as(superuser) | ||
old_permission_count = len(Permission.query.all()) | ||
# Goes to homepage | ||
res = testapp.get('/') | ||
|
@@ -108,7 +109,21 @@ def test_cataloging_admin_can_edit_permission_from_user_view(user, permission, s | |
res = res.click(href=url_for('user.view', user_id=permission.user_id)) | ||
# Clicks Edit on a permission on the user view | ||
res = res.click(href=url_for('permission.edit', permission_id=permission.id)) | ||
# Fills out the form, by changing to another user | ||
# Finds that the intended user doesn't exist | ||
res = res.click(_('New User')) | ||
# Fills out the user registration form | ||
register_user_form = res.forms['registerUserForm'] | ||
register_user_form['username'] = '[email protected]' | ||
register_user_form['full_name'] = 'Other User' | ||
register_user_form['send_password_reset_email'].checked = False | ||
res = register_user_form.submit() | ||
assert res.status_code == 302 | ||
assert url_for('permission.edit', permission_id=permission.id) in res.location | ||
other_user = User.get_by_email('[email protected]') | ||
# Fills out the form to grant 'other_user' permissions on 'collection' | ||
res = res.follow() | ||
assert res.status_code == 200 | ||
# Fills out the form, by changing to 'other_user'' | ||
form = res.forms['editPermissionForm'] | ||
# Defaults are kept, setting ``form['collection_id'] = permission.collection.id`` is redundant | ||
form['user_id'] = other_user.id | ||
|
@@ -138,8 +153,9 @@ def test_superuser_sees_error_if_permission_is_already_registered(superuser, per | |
form['password'] = 'myPrecious' | ||
# Submits | ||
res = form.submit().follow() | ||
# Clicks Permissions button | ||
res = res.click(_('Permissions')) | ||
assert res.status_code == 200 | ||
# Goes to Permissions' overview | ||
res = testapp.get(url_for('permission.home')) | ||
# Clicks Edit button on 'permission' | ||
res = res.click(href=url_for('permission.edit', permission_id=permission.id)) | ||
# Fills out the form with same user ID and collection ID as 'other_permission' | ||
|
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 |
---|---|---|
|
@@ -8,8 +8,9 @@ | |
from jinja2 import escape | ||
|
||
from xl_auth.permission.models import Permission | ||
from xl_auth.user.models import User | ||
|
||
from ..factories import PermissionFactory, UserFactory | ||
from ..factories import PermissionFactory | ||
|
||
|
||
def test_superuser_can_register_new_permission(superuser, collection, testapp): | ||
|
@@ -23,8 +24,9 @@ def test_superuser_can_register_new_permission(superuser, collection, testapp): | |
form['password'] = 'myPrecious' | ||
# Submits | ||
res = form.submit().follow() | ||
# Clicks Permissions button | ||
res = res.click(_('Permissions')) | ||
assert res.status_code == 200 | ||
# Goes to Permissions' overview | ||
res = testapp.get(url_for('permission.home')) | ||
# Clicks Register New Permission button | ||
res = res.click(_('New Permission')) | ||
# Fills out the form | ||
|
@@ -49,28 +51,40 @@ def test_cataloging_admin_can_register_permission_from_collection_view(user, col | |
testapp): | ||
"""Register new permission from collection view as cataloging admin.""" | ||
PermissionFactory(user=user, collection=collection, cataloging_admin=True).save_as(superuser) | ||
other_user = UserFactory().save_as(superuser) | ||
old_permission_count = len(Permission.query.all()) | ||
# Goes to homepage | ||
res = testapp.get('/') | ||
# Fills out login form | ||
form = res.forms['loginForm'] | ||
form['username'] = user.email | ||
form['password'] = 'myPrecious' | ||
login_form = res.forms['loginForm'] | ||
login_form['username'] = user.email | ||
login_form['password'] = 'myPrecious' | ||
# Submits | ||
res = form.submit().follow() | ||
res = login_form.submit().follow() | ||
# Clicks to View Collection from profile | ||
res = res.click(href=url_for('collection.view', collection_code=collection.code)) | ||
# Clicks Register New Permission | ||
res = res.click(_('New Permission')) | ||
# Finds that the intended user doesn't exist | ||
res = res.click(_('New User')) | ||
# Fills out the user registration form | ||
register_user_form = res.forms['registerUserForm'] | ||
register_user_form['username'] = '[email protected]' | ||
register_user_form['full_name'] = 'Registrant' | ||
register_user_form['send_password_reset_email'].checked = False | ||
res = register_user_form.submit() | ||
assert res.status_code == 302 | ||
assert url_for('permission.register', collection_id=collection.id) in res.location | ||
other_user = User.get_by_email('[email protected]') | ||
# Fills out the form to grant 'other_user' permissions on 'collection' | ||
form = res.forms['registerPermissionForm'] | ||
form['user_id'] = other_user.id | ||
# Defaults are kept, setting ``form['collection_id'] = collection.id`` is redundant | ||
form['registrant'].checked = True | ||
form['cataloger'].checked = True | ||
res = res.follow() | ||
assert res.status_code == 200 | ||
register_permission_form = res.forms['registerPermissionForm'] | ||
register_permission_form['user_id'] = other_user.id | ||
# Defaults are kept, ``register_permission_form['collection_id'] = collection.id`` is redundant | ||
register_permission_form['registrant'].checked = True | ||
register_permission_form['cataloger'].checked = True | ||
# Submits | ||
res = form.submit() | ||
res = register_permission_form.submit() | ||
assert res.status_code == 302 | ||
assert url_for('collection.view', collection_code=collection.code) in res.location | ||
res = res.follow() | ||
|
@@ -139,8 +153,9 @@ def test_superuser_sees_error_if_permission_is_already_registered(superuser, per | |
form['password'] = 'myPrecious' | ||
# Submits | ||
res = form.submit().follow() | ||
# Clicks Permissions button | ||
res = res.click(_('Permissions')) | ||
assert res.status_code == 200 | ||
# Goes to Permissions' overview | ||
res = testapp.get(url_for('permission.home')) | ||
# Clicks Register New Permission button | ||
res = res.click(_('New Permission')) | ||
# Fills out the form with same user ID and collection ID as (existing) 'permission' | ||
|
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
Oops, something went wrong.