Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using Computed Field as a column in check for permission #6055

Closed
archywillhe opened this issue Oct 21, 2020 · 1 comment
Closed

using Computed Field as a column in check for permission #6055

archywillhe opened this issue Oct 21, 2020 · 1 comment

Comments

@archywillhe
Copy link

archywillhe commented Oct 21, 2020

Looks like right now only PGColumn is supported to be used as a column in check for permission. https://hasura.io/docs/1.0/graphql/core/auth/authorization/permission-rules.html

Will be nice if Computed Field is supported too. So say if a user is only allowed to insert at most N rows to a table we can restrict that using an insert check i.e. by having a Computed Field like this to get the count:

CREATE OR REPLACE FUNCTION public.get_app_count(user_row user)
 RETURNS integer
 LANGUAGE plpgsql
 STABLE
AS $function$
declare
   app_count integer;
begin
   select count(*) 
   into app_count
   from app_profile
   where app_profile.user.id = user.id;
   return app_count;
end;
$function$

related to - #4356

@archywillhe archywillhe changed the title using computed_field as a column in check for permission using Computed Field as a column in check for permission Oct 21, 2020
@tirumaraiselvan
Copy link
Contributor

Closing this as a dupe of #5646

Would be great if you could comment with your use-case over there!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants