Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
User expired
tcexam_uibk
Commits
beb84cd2
Commit
beb84cd2
authored
Aug 09, 2016
by
User expired
Browse files
changed tce group postgresql functions to prevent duplicate groupname error
parent
65e3c560
Changes
1
Hide whitespace changes
Inline
Side-by-side
install/postgres_db_structure_functions.sql
View file @
beb84cd2
...
...
@@ -82,11 +82,6 @@ ALTER FUNCTION set_admin_group(bigint, bigint)
OWNER
TO
tcexam
;
-- functions for tcexam esb integration
-- assign_tcexam_user_to_group
...
...
@@ -284,6 +279,7 @@ $BODY$
DECLARE
externalid
character
varying
;
appointmentid
character
varying
;
groupname
character
varying
;
grouptype
character
varying
;
groupvo
xml
;
...
...
@@ -292,12 +288,16 @@ BEGIN
externalid
=
CONCAT
(
pgroupid
,
':'
,
pappointmentid
);
IF
pappointmentid
=
'owner'
THEN
grouptype
=
'B'
;
pappointmentid
=
'Betreuergruppe'
;
END
IF
;
groupname
=
CONCAT
(
pgroupname
,
' - '
,
pappointmentid
);
IF
NOT
EXISTS
(
SELECT
group_id
FROM
tce_user_groups
WHERE
external_id
=
externalid
)
THEN
INSERT
INTO
tce_user_groups
(
group_name
,
external_id
,
group_type
)
VALUES
(
p
groupname
,
externalid
,
grouptype
);
INSERT
INTO
tce_user_groups
(
group_name
,
external_id
,
group_type
)
VALUES
(
groupname
,
externalid
,
grouptype
);
END
IF
;
END
;
$
BODY
$
END
;
$
BODY
$
LANGUAGE
plpgsql
VOLATILE
SECURITY
DEFINER
-- Set a secure search_path: trusted schema(s), then 'pg_temp'.
...
...
@@ -404,7 +404,7 @@ BEGIN
theKey
=
pgroupid
||
':'
||
pappointmentid
;
IF
(
SELECT
group_name
FROM
tce_user_groups
WHERE
external_id
=
theKey
)
!=
pgroupname
THEN
UPDATE
tce_user_groups
set
group_name
=
pgroupname
WHERE
external_id
=
theKey
;
UPDATE
tce_user_groups
set
group_name
=
CONCAT
(
pgroupname
,
' - '
,
pappointmentid
)
WHERE
external_id
=
theKey
;
END
IF
;
END
;
$
BODY
$
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment