Commit 95d2f9c3 authored by Aatish Neupane's avatar Aatish Neupane

add rules package, create rule for is_job_poster

parent 58c739c4
......@@ -48,6 +48,9 @@ INSTALLED_APPS += [
# before 'django.contrib.admin' app
'dal',
'dal_select2',
# for authorization
'rules',
]
# Our apps
......@@ -115,6 +118,10 @@ AUTH_PASSWORD_VALIDATORS = [
},
]
AUTHENTICATION_BACKENDS = (
'rules.permissions.ObjectPermissionBackend',
'django.contrib.auth.backends.ModelBackend',
)
# Internationalization
# https://docs.djangoproject.com/en/2.1/topics/i18n/
......
import rules
@rules.predicate
def is_job_poster(user, job):
return job.posted_by == user
rules.add_perm('jobs.change_job', is_job_poster)
Django==2.1.2
django-crispy-forms==1.7.2
git+https://github.com/yourlabs/django-autocomplete-light.git#egg=django-autocomplete-light
rules==2.0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment