mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 03:17:07 +00:00
fix: Only allow users to create rels as source
There is now no field for users to define the source of a relationship The source is always the person in the URL And only that user or staff can access the form
This commit is contained in:
@@ -23,7 +23,9 @@ class UserIsLinkedPersonMixin(UserPassesTestMixin):
|
||||
test_person = self.get_object()
|
||||
|
||||
if not isinstance(test_person, models.Person):
|
||||
raise AttributeError('View incorrectly configured: \'related_person_field\' must be defined.')
|
||||
raise AttributeError(
|
||||
'View incorrectly configured: \'related_person_field\' must be defined.'
|
||||
)
|
||||
|
||||
return test_person
|
||||
|
||||
@@ -34,4 +36,5 @@ class UserIsLinkedPersonMixin(UserPassesTestMixin):
|
||||
Require that user is either staff or is the linked person.
|
||||
"""
|
||||
user = self.request.user
|
||||
return user.is_authenticated and (user.is_staff or self.get_test_person() == user.person)
|
||||
return user.is_authenticated and (
|
||||
user.is_staff or self.get_test_person() == user.person)
|
||||
|
||||
Reference in New Issue
Block a user