Commit fe4fe633 authored by Jean-Baptiste's avatar Jean-Baptiste

update: fix user permission using the new urlid field

parent 5bee591e
Pipeline #5408 passed with stage
in 1 minute and 19 seconds
......@@ -167,7 +167,7 @@ class LDPSource(Model):
@receiver([post_save])
def auto_urlid(sender, instance, **kwargs):
if isinstance(instance, Model) and (instance.urlid is None or instance.urlid == ''):
if isinstance(instance, Model) and (instance.urlid is None or instance.urlid == '' or 'None' in instance.urlid):
instance.urlid = instance.get_absolute_url()
instance.save()
......@@ -46,8 +46,9 @@ class LDPPermissions(BasePermission):
else:
if obj and hasattr(model._meta, 'owner_field') and (
getattr(obj, getattr(model._meta, 'owner_field')) == user or getattr(obj, getattr(model._meta,
'owner_field')) == user.id):
getattr(obj, getattr(model._meta, 'owner_field')) == user
or getattr(obj, getattr(model._meta, 'owner_field')) == user.urlid
or getattr(obj, getattr(model._meta, 'owner_field')) == user.id):
return owner_perms
else:
......
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