Skip to content

Commit

Permalink
[mobilepaytool] Add permissions to MobilePaytool
Browse files Browse the repository at this point in the history
  • Loading branch information
falkecarlsen committed Nov 23, 2020
1 parent 5965110 commit bc02cb8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 2.2.13 on 2020-11-23 12:44

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('stregsystem', '0012_mobilepayment'),
]

operations = [
migrations.AlterModelOptions(
name='mobilepayment',
options={'permissions': (('mobilepaytool_access', 'MobilePaytool access'),)},
),
]
4 changes: 4 additions & 0 deletions stregsystem/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,10 @@ def delete(self, *args, **kwargs):


class MobilePayment(models.Model):
class Meta:
permissions = (
("mobilepaytool_access", "MobilePaytool access"),
)
UNSET = 'U'
APPROVED = 'A'
IGNORED = 'I'
Expand Down
5 changes: 4 additions & 1 deletion stregsystem/templates/admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,23 @@

{% endif %}

{% if perms.stregsystem.import_batch_payments %}
{% if perms.stregsystem.import_batch_payments or perms.stregsystem.mobilepaytool_access %}
<div class="module">
<table>
<caption><a class="section">{% blocktrans with app.name as name %}Indbetalinger{% endblocktrans %}</a></caption>
{% if perms.stregsystem.mobilepaytool_access %}
<tr>
<th scope="row"><a href = "/admin/mobilepaytool/">MobilePaytool</a></th>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
{% elif perms.stregsystem.import_batch_payments %}
<tr>
<th scope="row"><a href = "/admin/batch/">Multi-indbetaling</a></th>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
{% endif %}
</table>
</div>
{% endif %}
Expand Down
1 change: 1 addition & 0 deletions stregsystem/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ def batch_payment(request):


@staff_member_required()
@permission_required("stregsystem.mobilepaytool_access")
def mobilepaytool(request):
paytool_form_set = modelformset_factory(MobilePayment, form=MobilePayToolForm, extra=0, fields=(
'timestamp', 'amount', 'member', 'comment', 'status')) # TODO: 'customer_name' removed, MobilepayAPI does not
Expand Down

0 comments on commit bc02cb8

Please sign in to comment.