Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused permissions #1290

Open
wants to merge 4 commits into
base: v0.105
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions elcid/detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,3 @@ class Result(detail.PatientDetailView):
display_name = "Test Results"
order = 5
template = "detail/result.html"

@classmethod
def visible_to(klass, user):
return user.profile.roles.filter(
name=constants.VIEW_LAB_TESTS_IN_DETAIL
).exists()
45 changes: 45 additions & 0 deletions elcid/migrations/0064_auto_20220124_1007.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Generated by Django 2.2.16 on 2022-01-24 10:07

from django.db import migrations

ROLE_NAMES = [
"view_lab_tests_in_list",
"view_lab_tests_in_detail",
"view_lab_test_trends",
"view_lab_test_json_in_detail"
]


def forwards(apps, schema_editor):
Role = apps.get_model(
'opal', 'Role'
)
Role.objects.filter(name__in=ROLE_NAMES).delete()


def backwards(apps, schema_editor):
Role = apps.get_model(
'opal', 'Role'
)
UserProfile = apps.get_model(
'opal.UserProfile'
)
roles = []
for role_name in ROLE_NAMES:
roles.append(Role.objects.create(name=role_name))

for user_profile in UserProfile.objects.all():
user_profile.roles.add(*roles)


class Migration(migrations.Migration):

dependencies = [
("elcid", "0063_merge_20220121_1017"),
]

operations = [
migrations.RunPython(
forwards, backwards
)
]
16 changes: 7 additions & 9 deletions elcid/templates/detail/infection_service.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@
{% include "panels/location.html" %}
{% record_panel models.Allergies %}
{% teams_panel %}
{% if permissions.view_lab_test_trends %}
<div class="panel panel-default">
<div class="panel-heading"><h3>
{% icon 'fa fa-crosshairs' %} Results
</h3></div>
<div class="panel-body overflow-x-auto">
{% include "partials/lab_test_sparklines.html" with target="patient" %}
</div>
<div class="panel panel-default">
<div class="panel-heading"><h3>
{% icon 'fa fa-crosshairs' %} Results
</h3></div>
<div class="panel-body overflow-x-auto">
{% include "partials/lab_test_sparklines.html" with target="patient" %}
</div>
{% endif %}
</div>


{% record_panel models.PrimaryDiagnosis %}
Expand Down
10 changes: 0 additions & 10 deletions elcid/templates/episode_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,7 @@ <h2>
</div>
</form>
</div>
{# comment #}
{% if permissions.view_lab_test_trends %}
{# endcomment #}

{% include 'partials/card_with_results.html' %}

{# comment #}
{% else %}
{% include 'partials/card_without_results.html' %}
{% endif %}
{# endcomment #}
<div class="empty-list" ng-hide="num_episodes > 0">
<p class="lead text-center">
There are no patients on this list.
Expand Down
2 changes: 0 additions & 2 deletions elcid/test/test_detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ def setUp(self):
profile, _ = UserProfile.objects.get_or_create(
user=self.permissioned
)
profile.roles.create(name=constants.VIEW_LAB_TESTS_IN_DETAIL)

self.not_permissioned = User.objects.create(
username="not_permissioned", password="not_permissioned"
)
Expand Down
9 changes: 0 additions & 9 deletions intrahospital_api/constants.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
# do they view the trend graphs in the detail page and in the list page
# also do they see the UpstreamBloodCulturePanel
VIEW_LAB_TEST_TRENDS = "view_lab_test_trends"

# do they see the Lab Tests Patient Detail View
VIEW_LAB_TESTS_IN_DETAIL = "view_lab_tests_in_detail"

# can they view the reconcile demographics patient list
UPDATE_DEMOGRAPHICS = "update_demographics"

INTRAHOSPITAL_ROLES = set([
VIEW_LAB_TEST_TRENDS,
VIEW_LAB_TESTS_IN_DETAIL,
UPDATE_DEMOGRAPHICS,
])

Expand Down
2 changes: 1 addition & 1 deletion plugins/covid/management/commands/create_covid_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def handle(self, *args, **kwargs):
profile.force_password_change = True
profile.save()

for role_name in ['view_lab_tests_in_list', 'view_lab_tests_in_detail', 'view_lab_test_trends', 'covid19']:
for role_name in ['covid19']:
profile.roles.add(Role.objects.get(name=role_name))


Expand Down