Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tarantool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
core
tarantool
Commits
6fe6f887
Commit
6fe6f887
authored
10 years ago
by
Konstantin Osipov
Browse files
Options
Downloads
Patches
Plain Diff
Set 'flags' field to an empty string for system spaces.
parent
208219ea
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
extra/schema_fill.lua
+42
-14
42 additions, 14 deletions
extra/schema_fill.lua
src/box/bootstrap.snap
+0
-0
0 additions, 0 deletions
src/box/bootstrap.snap
test/box/access_misc.result
+8
-8
8 additions, 8 deletions
test/box/access_misc.result
test/box/bootstrap.result
+7
-7
7 additions, 7 deletions
test/box/bootstrap.result
with
57 additions
and
29 deletions
extra/schema_fill.lua
+
42
−
14
View file @
6fe6f887
--
Super User ID
--
Guest user id - the default user
GUEST
=
0
GUEST
=
0
-- Super User ID
ADMIN
=
1
ADMIN
=
1
-- role 'PUBLIC' is special, it's automatically granted to every user
PUBLIC
=
2
PUBLIC
=
2
--
-- system spaces
--
_schema
=
box
.
space
[
box
.
schema
.
SCHEMA_ID
]
_schema
=
box
.
space
[
box
.
schema
.
SCHEMA_ID
]
_space
=
box
.
space
[
box
.
schema
.
SPACE_ID
]
_space
=
box
.
space
[
box
.
schema
.
SPACE_ID
]
_index
=
box
.
space
[
box
.
schema
.
INDEX_ID
]
_index
=
box
.
space
[
box
.
schema
.
INDEX_ID
]
...
@@ -12,13 +17,35 @@ _cluster = box.space[box.schema.CLUSTER_ID]
...
@@ -12,13 +17,35 @@ _cluster = box.space[box.schema.CLUSTER_ID]
-- define schema version
-- define schema version
_schema
:
insert
{
'version'
,
1
,
6
}
_schema
:
insert
{
'version'
,
1
,
6
}
-- define system spaces
-- define system spaces
_space
:
insert
{
_schema
.
id
,
ADMIN
,
'_schema'
,
'memtx'
,
0
}
--
_space
:
insert
{
_space
.
id
,
ADMIN
,
'_space'
,
'memtx'
,
0
}
-- _schema
_space
:
insert
{
_index
.
id
,
ADMIN
,
'_index'
,
'memtx'
,
0
}
--
_space
:
insert
{
_func
.
id
,
ADMIN
,
'_func'
,
'memtx'
,
0
}
_space
:
insert
{
_schema
.
id
,
ADMIN
,
'_schema'
,
'memtx'
,
0
,
''
}
_space
:
insert
{
_user
.
id
,
ADMIN
,
'_user'
,
'memtx'
,
0
}
--
_space
:
insert
{
_priv
.
id
,
ADMIN
,
'_priv'
,
'memtx'
,
0
}
-- _space
_space
:
insert
{
_cluster
.
id
,
ADMIN
,
'_cluster'
,
'memtx'
,
0
}
--
_space
:
insert
{
_space
.
id
,
ADMIN
,
'_space'
,
'memtx'
,
0
,
''
}
--
-- _index
--
_space
:
insert
{
_index
.
id
,
ADMIN
,
'_index'
,
'memtx'
,
0
,
''
}
--
-- _func
--
_space
:
insert
{
_func
.
id
,
ADMIN
,
'_func'
,
'memtx'
,
0
,
''
}
--
-- _user
--
_space
:
insert
{
_user
.
id
,
ADMIN
,
'_user'
,
'memtx'
,
0
,
''
}
--
-- _priv
--
_space
:
insert
{
_priv
.
id
,
ADMIN
,
'_priv'
,
'memtx'
,
0
,
''
}
--
-- _cluster
--
_space
:
insert
{
_cluster
.
id
,
ADMIN
,
'_cluster'
,
'memtx'
,
0
,
''
}
-- define indexes
-- define indexes
_index
:
insert
{
_schema
.
id
,
0
,
'primary'
,
'tree'
,
1
,
1
,
0
,
'str'
}
_index
:
insert
{
_schema
.
id
,
0
,
'primary'
,
'tree'
,
1
,
1
,
0
,
'str'
}
...
@@ -45,8 +72,6 @@ _index:insert{_func.id, 0, 'primary', 'tree', 1, 1, 0, 'num'}
...
@@ -45,8 +72,6 @@ _index:insert{_func.id, 0, 'primary', 'tree', 1, 1, 0, 'num'}
_index
:
insert
{
_func
.
id
,
1
,
'owner'
,
'tree'
,
0
,
1
,
1
,
'num'
}
_index
:
insert
{
_func
.
id
,
1
,
'owner'
,
'tree'
,
0
,
1
,
1
,
'num'
}
_index
:
insert
{
_func
.
id
,
2
,
'name'
,
'tree'
,
1
,
1
,
2
,
'str'
}
_index
:
insert
{
_func
.
id
,
2
,
'name'
,
'tree'
,
1
,
1
,
2
,
'str'
}
--
--
-- space schema is: grantor id, user id, object_type, object_id, privilege
-- primary key: user id, object type, object id
_index
:
insert
{
_priv
.
id
,
0
,
'primary'
,
'tree'
,
1
,
3
,
1
,
'num'
,
2
,
'str'
,
3
,
'num'
}
_index
:
insert
{
_priv
.
id
,
0
,
'primary'
,
'tree'
,
1
,
3
,
1
,
'num'
,
2
,
'str'
,
3
,
'num'
}
-- owner index - to quickly find all privileges granted by a user
-- owner index - to quickly find all privileges granted by a user
_index
:
insert
{
_priv
.
id
,
1
,
'owner'
,
'tree'
,
0
,
1
,
0
,
'num'
}
_index
:
insert
{
_priv
.
id
,
1
,
'owner'
,
'tree'
,
0
,
1
,
0
,
'num'
}
...
@@ -57,20 +82,23 @@ _index:insert{_cluster.id, 0, 'primary', 'tree', 1, 1, 0, 'num'}
...
@@ -57,20 +82,23 @@ _index:insert{_cluster.id, 0, 'primary', 'tree', 1, 1, 0, 'num'}
-- node uuid key: node uuid
-- node uuid key: node uuid
_index
:
insert
{
_cluster
.
id
,
1
,
'uuid'
,
'tree'
,
1
,
1
,
1
,
'str'
}
_index
:
insert
{
_cluster
.
id
,
1
,
'uuid'
,
'tree'
,
1
,
1
,
1
,
'str'
}
--
--
-- Pre-create user and grants
-- Pre-created users and grants
--
_user
:
insert
{
GUEST
,
ADMIN
,
'guest'
,
'user'
}
_user
:
insert
{
GUEST
,
ADMIN
,
'guest'
,
'user'
}
_user
:
insert
{
ADMIN
,
ADMIN
,
'admin'
,
'user'
}
_user
:
insert
{
ADMIN
,
ADMIN
,
'admin'
,
'user'
}
_user
:
insert
{
PUBLIC
,
ADMIN
,
'public'
,
'role'
}
_user
:
insert
{
PUBLIC
,
ADMIN
,
'public'
,
'role'
}
-- space schema is: grantor id, user id, object_type, object_id, privilege
-- primary key: user id, object type, object id
RPL_ID
=
_user
:
auto_increment
{
ADMIN
,
'replication'
,
'role'
}[
1
]
RPL_ID
=
_user
:
auto_increment
{
ADMIN
,
'replication'
,
'role'
}[
1
]
-- grant admin access to the universe
-- grant admin access to the universe
_priv
:
insert
{
1
,
1
,
'universe'
,
0
,
7
}
_priv
:
insert
{
1
,
1
,
'universe'
,
0
,
7
}
-- grant 'public' role access to 'box.schema.user.info' function
-- grant 'public' role access to 'box.schema.user.info' function
_func
:
insert
{
1
,
1
,
'box.schema.user.info'
,
1
}
_func
:
insert
{
1
,
1
,
'box.schema.user.info'
,
1
}
_priv
:
insert
{
1
,
2
,
'function'
,
1
,
4
}
_priv
:
insert
{
1
,
2
,
'function'
,
1
,
4
}
-- replication can read universe
-- replication can read
the entire
universe
_priv
:
insert
{
1
,
RPL_ID
,
'universe'
,
0
,
1
}
_priv
:
insert
{
1
,
RPL_ID
,
'universe'
,
0
,
1
}
-- replication can append to '_cluster' system space
-- replication can append to '_cluster' system space
_priv
:
insert
{
1
,
RPL_ID
,
'space'
,
box
.
schema
.
CLUSTER_ID
,
2
}
_priv
:
insert
{
1
,
RPL_ID
,
'space'
,
box
.
schema
.
CLUSTER_ID
,
2
}
-- grant
'guest'
role 'public'
-- grant role 'public'
to 'guest'
_priv
:
insert
{
1
,
0
,
'role'
,
2
,
4
}
_priv
:
insert
{
1
,
0
,
'role'
,
2
,
4
}
This diff is collapsed.
Click to expand it.
src/box/bootstrap.snap
+7 B (+0%)
View file @
6fe6f887
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
This diff is collapsed.
Click to expand it.
test/box/access_misc.result
+
8
−
8
View file @
6fe6f887
...
@@ -253,7 +253,7 @@ box.space._user:select(1)
...
@@ -253,7 +253,7 @@ box.space._user:select(1)
...
...
box.space._space:select(280)
box.space._space:select(280)
---
---
- - [280, 1, '_space', 'memtx', 0]
- - [280, 1, '_space', 'memtx', 0
, ''
]
...
...
us = box.schema.create_space('uniuser_space')
us = box.schema.create_space('uniuser_space')
---
---
...
@@ -577,13 +577,13 @@ box.space._user:select()
...
@@ -577,13 +577,13 @@ box.space._user:select()
...
...
box.space._space:select()
box.space._space:select()
---
---
- - [272, 1, '_schema', 'memtx', 0]
- - [272, 1, '_schema', 'memtx', 0
, ''
]
- [280, 1, '_space', 'memtx', 0]
- [280, 1, '_space', 'memtx', 0
, ''
]
- [288, 1, '_index', 'memtx', 0]
- [288, 1, '_index', 'memtx', 0
, ''
]
- [296, 1, '_func', 'memtx', 0]
- [296, 1, '_func', 'memtx', 0
, ''
]
- [304, 1, '_user', 'memtx', 0]
- [304, 1, '_user', 'memtx', 0
, ''
]
- [312, 1, '_priv', 'memtx', 0]
- [312, 1, '_priv', 'memtx', 0
, ''
]
- [320, 1, '_cluster', 'memtx', 0]
- [320, 1, '_cluster', 'memtx', 0
, ''
]
...
...
box.space._func:select()
box.space._func:select()
---
---
...
...
This diff is collapsed.
Click to expand it.
test/box/bootstrap.result
+
7
−
7
View file @
6fe6f887
...
@@ -47,13 +47,13 @@ box.space._cluster:select{}
...
@@ -47,13 +47,13 @@ box.space._cluster:select{}
...
...
box.space._space:select{}
box.space._space:select{}
---
---
- - [272, 1, '_schema', 'memtx', 0]
- - [272, 1, '_schema', 'memtx', 0
, ''
]
- [280, 1, '_space', 'memtx', 0]
- [280, 1, '_space', 'memtx', 0
, ''
]
- [288, 1, '_index', 'memtx', 0]
- [288, 1, '_index', 'memtx', 0
, ''
]
- [296, 1, '_func', 'memtx', 0]
- [296, 1, '_func', 'memtx', 0
, ''
]
- [304, 1, '_user', 'memtx', 0]
- [304, 1, '_user', 'memtx', 0
, ''
]
- [312, 1, '_priv', 'memtx', 0]
- [312, 1, '_priv', 'memtx', 0
, ''
]
- [320, 1, '_cluster', 'memtx', 0]
- [320, 1, '_cluster', 'memtx', 0
, ''
]
...
...
box.space._index:select{}
box.space._index:select{}
---
---
...
...
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