It is inside the “user menu” only because this is where Numerus has the same option, although it makes less sense in this case, because Numerus is geared toward individual freelancers while Camper is for companies. But, since it is easy to change afterward, this will do for now. However, it should be only shown to admin users, because regular employees have no UPDATE privilege on the company relation. Thus, the need for a new template function to check if the user is admin. Part of #17.
24 lines
382 B
PL/PgSQL
24 lines
382 B
PL/PgSQL
-- Deploy camper:input_is_valid to pg
|
|
-- requires: roles
|
|
-- requires: schema_public
|
|
|
|
begin;
|
|
|
|
set search_path to public;
|
|
|
|
create or replace function input_is_valid(input text, domname text) returns boolean as
|
|
$$
|
|
begin
|
|
begin
|
|
execute format('select %L::%s', input, domname);
|
|
return true;
|
|
exception when others then
|
|
return false;
|
|
end;
|
|
end;
|
|
$$
|
|
language plpgsql
|
|
stable;
|
|
|
|
commit;
|