这是indexloc提供的服务,不要输入任何密码
Skip to content

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

@meetzaveri

Description

@meetzaveri

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions