Right now we need to define view and control permission in the meta class of every model so that they can be used and served by Django LDP.
Django LDP should add them to the default permissions of every model. The problem is that they are hard coded in django. The only solution seems to be a runtime patch.
Edited
Designs
Child items
...
Show closed items
Linked items
...
Activity
Sort or filter
Newest first
Oldest first
Show all activity
Show comments only
Show history only
Sylvain Le Bonchanged title from Add view to default permissions, if possible to Add view and control to default permissions, if possible
changed title from Add view to default permissions, if possible to Add view and control to default permissions, if possible
(moved from #50 (closed)) Just checking the requirement here:
in this case..
class LDNotification(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL) author = models.URLField() object = models.URLField() type = models.CharField(max_length=255) summary = models.TextField() class Meta: permissions = ( ('view_todo', 'Read'), ('control_todo', 'Control'), )
there is some binding (the one in urls.py?) of the token "todo" (i cant see any other mention in djangoldp) to the class LDnotification, so that these permissions are checked? And this is ugly because the class cant and really shouldnt know what it gets bound to, hence we want to inject these automatically on binding?
By Rob on 2018-11-05T12:06:29 (imported from GitLab project)
Oh yes - i get the reason not to have these :-) was just confused by that ! OK I can have a look ..glad i didnt spend a lot of time trying to trace something that didnt exist!
By Rob on 2018-11-06T20:27:02 (imported from GitLab project)
Q1 - does it already take some sort of permissions override - quick scout of docs and google didnt find anything
Q2 - what does Something look like.. one choice is..
(
('view_source', 'acl:Read'),
('control_source', 'acl:Control'),
)
but it seems redundant - we know the model - and where are the keyword "view_" and "Read" (and what does acl:Read mean vs Read) defined. I have browsed code rest and guardian documentation and havent yet located references for this - so quickest if you can provide a pointer.
Q3 - do we only want absolute overwrite of defaults, or optional extra_permissions=() and exclude_permissions=() params
By Rob on 2018-11-07T10:01:47 (imported from GitLab project)
I have checked and adding a permission does trigger a migration. I'm not sure if it actually changes something in the database, but I think it'd be better if the options set in the migrations include view and control.
Regarding the options, we have quite a few use cases, and I think we'll need some time to have a global view on them. One use case we're already having is the inbox case. Every user has a container on which any one can post a notification. So this container is publicly write only, and readable by its owner only. The way to implement this right now is to develop a Permission class in DRF. It could be interesting to have another way to do it.
But you don't really have to bother with that. We'll deal with it with the context. I have to check, but we probably want to replace them with Read in Django.