[GeoNode-devel] Bulk permissions for Documents

Paolo Pasquali paolo.pasquali at gmail.com
Thu Nov 18 02:56:32 PST 2021


Hi Devs,

It seems I can achieve my goal by deleting some records in the geonode db.
I know it is quite dangerous so I'm posting it here for advice from you.

So, for instance, if I want to remove the capability to download uploaded
documents by non-registered users I should:

DELETE FROM guardian_userobjectpermission WHERE object_pk = '523' AND
permission_id = 162 AND user_id = '-1';

DELETE FROM guardian_groupobjectpermission WHERE object_pk = '523' AND
permission_id = 162 AND group_id = '1';

Where 523 is one of the document I want to change the permissions and 162
is the download permission. Starting from this query I can change
permissions in bulk.

Is it safe to proceed this way or is there a management command for
documents I can use?
Thanks!

Bye,

P.



On Wed, Nov 17, 2021 at 5:14 PM Paolo Pasquali <paolo.pasquali at gmail.com>
wrote:

> Dear devs,
>
> I would like to set permissions in bulk for documents. For instance, I'd
> like that only a certain users group can download some documents or
> unregistered users cannot download any document.
>
> While the cart is available on the layers page only, I wonder if the
> set_layers_permissions command [1] can be used on the documents as well. It
> seems not.
>
> Any suggestion on how to proceed?
>
> Thanks for your help.
>
> Ciao
>
> Paolo
>
>
> [1]
> https://docs.geonode.org/en/master/admin/mgmt_commands/index.html#batch-sync-permissions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-devel/attachments/20211118/6676abf1/attachment.html>


More information about the geonode-devel mailing list