question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reusing permissions

See original GitHub issue

It would be very useful to be able to reuse permission definitions in some way. Let’s say you have these tables (should be self-explanatory, a basic setup for groups with users who can author comment on posts)

user
group
post
comment

group_member (user+group relation)
group_post (post+group relation)
group_post_comment (post+comment relation)

The overarching permission setup here is through the group_member table. If there is an entry for a given group and a given user, that user can access any post and comment in the group.

Currently I have to duplicate this permission check (“user is member of group”) in the group, post, comment, group_post and group_post_comment. All that duplication makes the configuration tedious and error-prone.

What I’m suggesting is some sort of functionality to indicate that a user has access to a post if they have access to the corresponding group, ie. delegate a select/insert/update/delete permission to another type. It gets even trickier when managing roles, so being able to indicate that you can delete a post if user_id = x-hasura-user-id or if “x-hasura-user-id is an admin or owner of <group>” would be amazing.

Is there currently an easier way to handle this than the duplication permissions? I realize this is a huge task, and would likely require a remake of the permission editor, but I’d like to know if anyone else is struggling a bit with this.

All that said, it’s not impossibly hard to do this currently, it could just be very much easier.

(Sorry if this has come up before, I couldn’t find any issues mentioning it)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Bessonovcommented, Jul 1, 2021

Run in the same challenge. I have an entity, let say A, with a little bit complex permission rules. Entity B has a FK to entity A and entity C has a FK to entity B. Both B and C follows the same rules like entity A: is entity A selectable, then B&C are selectable too. Same for update and delete. It would be great if I could specify in entity C something like {"b":{"a":{"_use_perm_from": "select"}}}.

1reaction
esseswanncommented, Feb 8, 2021
  1. Delegation by foreign key: on a group_post (a table containing posts in a group), with a foreign key to groups, you would say that if you have access to the referenced group, you also have access to the group_post.

This is probably a valid approach since if the referenced table row’s key is not accessible because of some permissions seems logical that another table rows referencing it through foreign key shouldn’t also be accessible. The problem is a possible explosion of joins when the algorithm is gonna traverse upwards and for each table does the same thing – check if the rows having foregin keys are accessible through parents

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ask IWAP: How do I get permission to reuse material?
When requesting permission, either to reuse your own work or material from another author's paper or book, you should include the following information...
Read more >
Get permission to reuse Springer Nature content
Go to the article or chapter page you wish to reuse content from. (Note: permissions are granted on the article or chapter level,...
Read more >
Reusing Writing: How to obtain permissions from other authors
To obtain permission to reuse copyrighted material, you'll have to track down the holder of the publishing rights to the work in question....
Read more >
Reuse Permissions - The American Ceramic Society
Procedure for Attaining Reuse Permissions · Locate the article or book content that you wish to reuse: · Click on the “Request Permissions”...
Read more >
Author Reuse and Self-Archiving - Oxford University Press
After publication you may reuse the following portions of your content without obtaining formal permission for the activities expressly listed below:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found