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

console: allow computed field (of boolean data type) to compare with boolean value in permissions builder #9101

Closed
meetzaveri opened this issue Oct 12, 2022 · 0 comments
Labels
k/bug Something isn't working t/native-dbs

Comments

@meetzaveri
Copy link
Member

Version Information

Server Version:v2.12.0-cloud.1

Environment

Cloud

What is the current behaviour?

In permissions builder, while writing custom check, when comparing computed field(of boolean data type) value to boolean value (lets say true or false), it results into casting true to string type("true") rather than actual boolean type.

let's say I've this custom sql function of return type of bool

CREATE OR REPLACE FUNCTION public."ageExceedsCriteria"(user_row users)
 RETURNS bool
 LANGUAGE plpgsql
 STABLE
AS $function$

BEGIN
    return user_row.age > 40;
END;

$function$

Then I create a computed field(for e.g., isAgeAbove40), and I assigned this function to it. Now when I compare it to true in permissions builder, it results into {"isAgeAbove40":{"_eq":"true"}}

What is the expected behaviour?

It should allow to compare to actual boolean value of true (which happens in case of non-computed fields having boolean type)

How to reproduce the issue?

  1. First, I created a custom sql function with return type of "bool"(boolean). This returns the expression which results into true or false.
  2. I created a computed field in existing table and assigned this custom sql function to it (which has return type of boolean)
  3. Now when I am trying to set up permissions for that computed field, lets say I want to check if computed field value is equal to true (This results into comparing value to string value of "true". {"isAgeAbove40":{"_eq":"true"}})

Screenshots or Screencast

permissions_builder_check_computed_field

Keywords

computed field permissions boolean

@meetzaveri meetzaveri added the k/bug Something isn't working label Oct 12, 2022
@rikinsk rikinsk closed this as completed Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
k/bug Something isn't working t/native-dbs
Projects
None yet
Development

No branches or pull requests

3 participants