-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bring all v0.3.1 changes from develop to master. (#406)
* Working on Credit Trade Permissions Changelog: - Model created - Serializers created and adjuste - privileged_access boolean field to control API visibility of comments Todo: - Create new permission (VIEW|EDIT)_PRIVILIGED_COMMENT - Create route/viewSet to save comments - Wire up the frontend - Unit tests * WIP Testing mostly finished now. A few more test cases to include for completeness. Pending: - Wire up the frontend - A handful of additional api test cases * Comments API API is now built and has thorough unit-testing * Split new permissions into release fixture roles_permissions_v0.3.0.json * Updated test to include new fixture * Python3 Compatibility Fix Adjusted permission class to use `'key' in dict` format rather than dict.has_key('key'). Confirmed working with Python 3.6.4 * Added Declined indicator in the breadcrumbs * Organizations balances (#384) Added front-end code to show Credit Balance of the selected organization for IDIR Users Added a check on the user's permission before showing the balance of the organization Updated test_api_custom so it follows pep8 coding style a bit better Added MinSerializer for Organization to reduce the amount of data (and add security) coming in for Credit Trades * Allow partial updates through PATCH. Rescinded should now be a flag * Updated breadcrumbs to show rescinded status. Added checks for permissions * Code cleanup * Comments UI complete * Cleanup * Typo fix * Cleanup * Minor refactoring. Added tests * Fixed tests * test site also uses logontest * Renamed the migration table for credit trade comment * Refactored to address review comments * Migrations fixed up * Added ETag and relevant testing for credit_trades query * Added tooltip for signing the proposal * Changing api to api-business shouldn't have been committed * Added dropdown-menu and Credit Market Report link
- Loading branch information
1 parent
d078248
commit c80d686
Showing
79 changed files
with
8,102 additions
and
5,374 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
File renamed without changes.
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,52 @@ | ||
[ | ||
{ | ||
"fields": { | ||
"code": "VIEW_PRIVILEGED_COMMENTS", | ||
"description": "View (Read) Privileged Comments", | ||
"name": "View Privileged Comments" | ||
}, | ||
"model": "api.permission", | ||
"pk": "16" | ||
}, | ||
{ | ||
"fields": { | ||
"code": "EDIT_PRIVILEGED_COMMENTS", | ||
"description": "Create and Update Privileged Comments", | ||
"name": "Edit Privileged Comments" | ||
}, | ||
"model": "api.permission", | ||
"pk": "17" | ||
}, | ||
{ | ||
"fields": { | ||
"permission": "16", | ||
"role": "2" | ||
}, | ||
"model": "api.rolepermission", | ||
"pk": null | ||
}, | ||
{ | ||
"fields": { | ||
"permission": "16", | ||
"role": "3" | ||
}, | ||
"model": "api.rolepermission", | ||
"pk": null | ||
}, | ||
{ | ||
"fields": { | ||
"permission": "17", | ||
"role": "2" | ||
}, | ||
"model": "api.rolepermission", | ||
"pk": null | ||
}, | ||
{ | ||
"fields": { | ||
"permission": "17", | ||
"role": "3" | ||
}, | ||
"model": "api.rolepermission", | ||
"pk": null | ||
} | ||
] |
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,174 @@ | ||
[ | ||
{ | ||
"fields": { | ||
"authorization_guid": "6c239bc5-5f08-4ddd-855a-b3bf39096937", | ||
"email": "[email protected]", | ||
"username": "fs1", | ||
"authorization_id": "fs1", | ||
"display_name": "Test FS", | ||
"first_name": "Test", | ||
"last_name": "FS", | ||
"organization_id": 2 | ||
}, | ||
"model": "api.user", | ||
"pk": 400 | ||
}, | ||
{ | ||
"fields": { | ||
"role": "4", | ||
"user": "400" | ||
}, | ||
"model": "api.userrole", | ||
"pk": null | ||
}, | ||
{ | ||
"fields": { | ||
"authorization_guid": "935bebdb-de2a-4839-a4da-d87635cffbb3", | ||
"email": "[email protected]", | ||
"username": "gov_priv", | ||
"authorization_id": "gov_priv", | ||
"display_name": "Gov", | ||
"first_name": "Gov", | ||
"last_name": "Gov", | ||
"organization_id": 1 | ||
}, | ||
"model": "api.user", | ||
"pk": 401 | ||
}, | ||
{ | ||
"fields": { | ||
"role": "2", | ||
"user": "401" | ||
}, | ||
"model": "api.userrole", | ||
"pk": null | ||
}, | ||
{ | ||
"fields": { | ||
"role": "3", | ||
"user": "401" | ||
}, | ||
"model": "api.userrole", | ||
"pk": null | ||
}, | ||
{ | ||
"fields": { | ||
"authorization_guid": "10385306-8e74-4ad5-8cc1-003bc50fbefd", | ||
"email": "[email protected]", | ||
"username": "gov_unpriv", | ||
"authorization_id": "gov_unpriv", | ||
"display_name": "Gov", | ||
"first_name": "Gov", | ||
"last_name": "Gov", | ||
"organization_id": 1 | ||
}, | ||
"model": "api.user", | ||
"pk": 402 | ||
}, | ||
{ | ||
"fields": { | ||
"authorization_guid": "1dfbe008-d321-4a1f-912d-ecca36730895", | ||
"email": "[email protected]", | ||
"username": "fs2", | ||
"authorization_id": "fs2", | ||
"display_name": "Test FS", | ||
"first_name": "Test", | ||
"last_name": "FS", | ||
"organization_id": 4 | ||
}, | ||
"model": "api.user", | ||
"pk": 403 | ||
}, | ||
{ | ||
"fields": { | ||
"role": "4", | ||
"user": "403" | ||
}, | ||
"model": "api.userrole", | ||
"pk": null | ||
}, | ||
{ | ||
"model": "api.credittrade", | ||
"pk": 200, | ||
"fields": { | ||
"create_timestamp": null, | ||
"create_user": null, | ||
"update_timestamp": null, | ||
"update_user": null, | ||
"status": 3, | ||
"initiator": 2, | ||
"respondent": 3, | ||
"type": 2, | ||
"number_of_credits": 1000, | ||
"fair_market_value_per_credit": "20.00", | ||
"zero_reason": null, | ||
"trade_effective_date": "2017-08-07", | ||
"note": null | ||
} | ||
}, | ||
{ | ||
"model": "api.credittradecomment", | ||
"pk": 1, | ||
"fields": { | ||
"create_timestamp": null, | ||
"create_user": 400, | ||
"update_timestamp": null, | ||
"update_user": null, | ||
"credit_trade": 200, | ||
"privileged_access": false, | ||
"comment": "Test Comment 1" | ||
} | ||
}, | ||
{ | ||
"model": "api.credittradecomment", | ||
"pk": 2, | ||
"fields": { | ||
"create_timestamp": null, | ||
"create_user": 400, | ||
"update_timestamp": null, | ||
"update_user": null, | ||
"credit_trade": 200, | ||
"privileged_access": true, | ||
"comment": "Test Comment (privileged)" | ||
} | ||
}, | ||
{ | ||
"model": "api.credittradecomment", | ||
"pk": 3, | ||
"fields": { | ||
"create_timestamp": null, | ||
"create_user": 401, | ||
"update_timestamp": null, | ||
"update_user": null, | ||
"credit_trade": 200, | ||
"privileged_access": false, | ||
"comment": "Test Comment 4 (belongs to user 401)" | ||
} | ||
}, | ||
{ | ||
"model": "api.credittradecomment", | ||
"pk": 4, | ||
"fields": { | ||
"create_timestamp": null, | ||
"create_user": 401, | ||
"update_timestamp": null, | ||
"update_user": null, | ||
"credit_trade": 200, | ||
"privileged_access": true, | ||
"comment": "Test Comment 4 (privileged, belongs to user 401)" | ||
} | ||
}, | ||
{ | ||
"model": "api.credittradecomment", | ||
"pk": 5, | ||
"fields": { | ||
"create_timestamp": null, | ||
"create_user": 403, | ||
"update_timestamp": null, | ||
"update_user": null, | ||
"credit_trade": 200, | ||
"privileged_access": false, | ||
"comment": "Test Comment 1 (belongs to user 403)" | ||
} | ||
} | ||
] |
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,30 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11 on 2018-06-13 18:48 | ||
from __future__ import unicode_literals | ||
|
||
import django.core.validators | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('api', '0010_auto_20180529_2003'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name='credittrade', | ||
options={}, | ||
), | ||
migrations.AlterField( | ||
model_name='user', | ||
name='cell_phone', | ||
field=models.CharField(blank=True, max_length=17, null=True, validators=[django.core.validators.RegexValidator(message=b"Phone number must be entered in theformat: '+999999999'. Up to 15 digitsallowed.", regex=b'^\\+?1?\\d{9,15}$')]), | ||
), | ||
migrations.AlterField( | ||
model_name='user', | ||
name='phone', | ||
field=models.CharField(blank=True, max_length=17, null=True, validators=[django.core.validators.RegexValidator(message=b"Phone number must be entered in theformat: '+999999999'. Up to 15 digitsallowed.", regex=b'^\\+?1?\\d{9,15}$')]), | ||
), | ||
] |
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,34 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11 on 2018-06-15 21:09 | ||
from __future__ import unicode_literals | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('api', '0011_auto_20180613_1848'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='CreditTradeComment', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('create_timestamp', models.DateTimeField(auto_now_add=True, null=True)), | ||
('update_timestamp', models.DateTimeField(auto_now=True, null=True)), | ||
('comment', models.CharField(blank=True, max_length=4000, null=True)), | ||
('create_user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='api_credittradecomment_CREATE_USER', to=settings.AUTH_USER_MODEL)), | ||
('credit_trade', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='credit_trade_comments', to='api.CreditTrade')), | ||
('update_user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='api_credittradecomment_UPDATE_USER', to=settings.AUTH_USER_MODEL)), | ||
('privileged_access', models.BooleanField(default=True)), | ||
], | ||
options={ | ||
'ordering': ['create_timestamp'], | ||
'db_table': 'credit_trade_comment', | ||
}, | ||
), | ||
] |
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,37 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11 on 2018-06-19 20:53 | ||
from __future__ import unicode_literals | ||
|
||
import django.core.validators | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('api', '0012_credittradecomment'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='credittrade', | ||
name='rescinded', | ||
field=models.BooleanField(default=False), | ||
), | ||
migrations.AddField( | ||
model_name='credittradehistory', | ||
name='rescinded', | ||
field=models.BooleanField(default=False), | ||
), | ||
migrations.AlterField( | ||
model_name='user', | ||
name='cell_phone', | ||
field=models.CharField(blank=True, max_length=17, null=True, validators=[django.core.validators.RegexValidator(message="Phone number must be entered in the format: '+999999999'. Up to 15 digits allowed.", regex='^\\+?1?\\d{9,15}$')]), | ||
), | ||
migrations.AlterField( | ||
model_name='user', | ||
name='phone', | ||
field=models.CharField(blank=True, max_length=17, null=True, validators=[django.core.validators.RegexValidator(message="Phone number must be entered in the format: '+999999999'. Up to 15 digits allowed.", regex='^\\+?1?\\d{9,15}$')]), | ||
), | ||
] |
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,22 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11 on 2018-06-19 17:57 | ||
from __future__ import unicode_literals | ||
|
||
import django.core.validators | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('api', '0013_auto_20180619_2053'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='credittradecomment', | ||
name='credit_trade', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='credit_trade_comments', to='api.CreditTrade'), | ||
) | ||
] |
Oops, something went wrong.