Annotation: office.is_sys_user

CREATE OR REPLACE FUNCTION office.is_sys_user(integer)
RETURNS boolean

Information: office.is_sys_user

Schema office
Function Name is_sys_user
Arguments integer
Owner postgres
Result Type boolean
Description

Implementation: office.is_sys_user

CREATE OR REPLACE FUNCTION office.is_sys_user(integer)
 RETURNS boolean
 LANGUAGE plpgsql
AS $function$
BEGIN
    IF EXISTS
    (
        SELECT * FROM office.users
        WHERE user_id=$1
        AND role_id IN
        (
            SELECT office.roles.role_id FROM office.roles WHERE office.roles.role_code='SYST'
        )
    ) THEN
        RETURN true;
    END IF;

    RETURN false;
END
$function$