CMDBuild Forum

In rows privileges of class why i cant use calculated parameter as *user logged*, response is "t's not allowed to use a filter with calculated parameters"

Hi CMDBuild team,

 

In rows of privileges of class why i can not use the calculated parameter as * user logged *, the response is "t have not been allowed to use a filter with calculated parameters", it is any problem and how can i use a function with parameters in rows privileges

 

Best regards

msylka

Hi msylka,

for row privilege filters you have to use a function that follows this template:
 
CREATE OR REPLACE FUNCTION grant_role_classname(IN "UserId" integer,IN "GroupId" integer, IN "ClassName" character varying, OUT "Number" integer)
  RETURNS SETOF integer AS
$BODY$
BEGIN
    RETURN QUERY EXECUTE
        'SELECT "Id"' ||
        '    FROM ' || quote_ident($3) ||
        '    WHERE' ||
        '        "Status" = ' || quote_literal('A') ||
        '        LIMIT 10 ';
END
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100
  ROWS 1000;
COMMENT ON FUNCTION grant_role_classname(integer, integer, character varying) IS 'TYPE: function';
 
Regards
CMDBuild Team

Hi everyone,
did anyone try this solution? Im not having any luck.

openmaint cmdbuild 2.5.1