Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
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
minerva
core
Commits
bf463f4f
Commit
bf463f4f
authored
5 years ago
by
Sascha Herzinger
Browse files
Options
Downloads
Patches
Plain Diff
fixed migration script
parent
000b4cfc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!836
Resolve "Implement Spring Security"
,
!613
WIP: New Minerva Security Layer
Pipeline
#11117
failed
5 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
persist/src/main/resources/db/migration/14.0.0~alpha.0/V14.0.0.20190618__new_permission_model.sql
+13
-13
13 additions, 13 deletions
...14.0.0~alpha.0/V14.0.0.20190618__new_permission_model.sql
with
13 additions
and
13 deletions
persist/src/main/resources/db/migration/14.0.0~alpha.0/V14.0.0.20190618__new_permission_model.sql
+
13
−
13
View file @
bf463f4f
...
...
@@ -26,6 +26,7 @@ from privilege_table where type = 'VIEW_PROJECT';
alter
table
privilege_table
drop
column
privilege_class_type_db
;
alter
table
privilege_table
drop
column
id
;
update
privilege_table
set
object_id
=
-
1
where
object_id
is
null
;
alter
table
privilege_table
add
primary
key
(
type
,
object_id
);
...
...
@@ -37,22 +38,22 @@ create table user_privilege_map_table (
);
insert
into
user_privilege_map_table
(
user_id
,
privilege
_id
)
select
s1
.
user_id
,
s2
.
id
insert
into
user_privilege_map_table
(
user_id
,
type
,
object
_id
)
select
s1
.
user_id
,
s2
.
type
,
s2
.
object_
id
from
(
select
user_id
,
object_id
from
privilege_table
where
type
=
'VIEW_PROJECT'
)
s1
inner
join
(
select
id
,
object_id
from
privilege_table
where
type
=
'READ_PROJECT'
)
s2
inner
join
(
select
type
,
object_id
from
privilege_table
where
type
=
'READ_PROJECT'
)
s2
on
s1
.
object_id
=
s2
.
object_id
;
insert
into
user_privilege_map_table
(
user_id
,
privilege
_id
)
select
user_id
,
(
select
id
from
privilege_table
where
type
=
'IS_ADMIN'
)
insert
into
user_privilege_map_table
(
user_id
,
type
,
object
_id
)
select
user_id
,
(
select
type
from
privilege_table
where
type
=
'IS_ADMIN'
)
,
-
1
from
privilege_table
where
type
=
'USER_MANAGEMENT'
;
insert
into
user_privilege_map_table
(
user_id
,
privilege
_id
)
select
user_id
,
(
select
id
from
privilege_table
where
type
=
'IS_CURATOR'
)
insert
into
user_privilege_map_table
(
user_id
,
type
,
object
_id
)
select
user_id
,
(
select
type
from
privilege_table
where
type
=
'IS_CURATOR'
)
,
-
1
from
privilege_table
where
type
=
'ADD_MAP'
;
insert
into
user_privilege_map_table
(
user_id
,
privilege
_id
)
select
user_id
,
(
select
id
from
privilege_table
where
type
=
'CAN_CREATE_OVERLAYS'
)
insert
into
user_privilege_map_table
(
user_id
,
type
,
object
_id
)
select
user_id
,
(
select
type
from
privilege_table
where
type
=
'CAN_CREATE_OVERLAYS'
)
,
-
1
from
privilege_table
where
type
=
'CUSTOM_LAYOUTS'
;
delete
from
privilege_table
where
type
=
'VIEW_PROJECT'
...
...
@@ -70,10 +71,9 @@ delete from privilege_table where type = 'VIEW_PROJECT'
delete
from
user_privilege_map_table
t1
using
user_privilege_map_table
t2
where
t1
.
CTID
!=
t2
.
CTID
and
t1
.
user_id
=
t2
.
user_id
and
t1
.
privilege_id
=
t2
.
privilege_id
;
and
t1
.
type
=
t2
.
type
and
t1
.
object_id
=
t2
.
object_id
;
alter
table
user_privilege_map_table
add
primary
key
(
user_id
,
privilege
_id
);
alter
table
user_privilege_map_table
add
primary
key
(
user_id
,
type
,
object
_id
);
alter
table
privilege_table
drop
column
user_id
;
alter
table
privilege_table
add
constraint
unique_rows
unique
(
privilege_class_type_db
,
type
,
object_id
);
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