Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tcexam_uibk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
User expired
tcexam_uibk
Commits
f48671a3
Commit
f48671a3
authored
8 years ago
by
User expired
Browse files
Options
Downloads
Patches
Plain Diff
postgresql functions for admin. groups
parent
926d679f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
install/postgres_db_structure_functions.sql
+44
-0
44 additions, 0 deletions
install/postgres_db_structure_functions.sql
with
44 additions
and
0 deletions
install/postgres_db_structure_functions.sql
+
44
−
0
View file @
f48671a3
...
...
@@ -23,7 +23,51 @@ ALTER TABLE tce_tests ADD COLUMN test_group_id bigint;
-- restraint dropped because a user locked in VIS can be registered again in TCExam later, but of course keeps his matrikelnr.
ALTER
TABLE
tce_users
DROP
CONSTRAINT
ak_user_regnumber
;
-- functions for administrative group
-- Function: get_admin_group(bigint, bigint)
-- DROP FUNCTION get_admin_group(bigint, bigint);
CREATE
OR
REPLACE
FUNCTION
get_admin_group
(
itest_id
bigint
,
igroup_id
bigint
)
RETURNS
bigint
AS
$
BODY
$
DECLARE
xgroup_id
bigint
;
BEGIN
SELECT
group_id
FROM
tce_user_groups
WHERE
external_id
=
(
SELECT
LEFT
(
external_id
,
strpos
(
external_id
,
':'
)
-
1
)
FROM
tce_user_groups
WHERE
group_id
=
igroup_id
)
||
':owner'
AND
group_type
=
'B'
into
xgroup_id
;
RETURN
xgroup_id
;
END
;
$
BODY
$
LANGUAGE
plpgsql
VOLATILE
SECURITY
DEFINER
COST
100
;
ALTER
FUNCTION
get_admin_group
(
bigint
,
bigint
)
SET
search_path
=
tcexam
,
pg_temp
;
ALTER
FUNCTION
get_admin_group
(
bigint
,
bigint
)
OWNER
TO
tcexam
;
-- Function: set_admin_group(bigint, bigint)
-- DROP FUNCTION set_admin_group(bigint, bigint);
CREATE
OR
REPLACE
FUNCTION
get_admin_group
(
itest_id
bigint
,
igroup_id
bigint
)
RETURNS
bigint
AS
$
BODY
$
DECLARE
xgroup_id
bigint
;
BEGIN
SELECT
group_id
FROM
tce_user_groups
WHERE
external_id
=
(
SELECT
LEFT
(
external_id
,
strpos
(
external_id
,
':'
)
-
1
)
FROM
tce_user_groups
WHERE
group_id
=
igroup_id
)
||
':owner'
AND
group_type
=
'B'
into
xgroup_id
;
RETURN
xgroup_id
;
END
;
$
BODY
$
LANGUAGE
plpgsql
VOLATILE
SECURITY
DEFINER
COST
100
;
ALTER
FUNCTION
get_admin_group
(
bigint
,
bigint
)
SET
search_path
=
tcexam
,
pg_temp
;
ALTER
FUNCTION
get_admin_group
(
bigint
,
bigint
)
OWNER
TO
tcexam
;
-- functions for tcexam esb integration
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment