File: gh-4606-admin-creds.test.lua

package info (click to toggle)
tarantool 2.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 85,364 kB
  • sloc: ansic: 513,760; cpp: 69,489; sh: 25,650; python: 19,190; perl: 14,973; makefile: 4,173; yacc: 1,329; sql: 1,074; pascal: 620; ruby: 190; awk: 18; lisp: 7
file content (26 lines) | stat: -rw-r--r-- 1,136 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
test_run = require('test_run').new()
--
-- gh-4606: the admin user has universal privileges before
-- bootstrap or recovery are done. That allows to, for example,
-- bootstrap from a remote master, because to do that the admin
-- should be able to insert into system spaces, such as _priv.
--
-- But the admin could lost its universal access if, for
-- example, a role was granted to him before universal access was
-- recovered. Because any change in access rights, even in granted
-- roles, led to rebuild of universal access.
--
box.schema.user.passwd('admin', '111')
box.schema.user.grant('admin', 'replication')
test_run:cmd("create server replica_auth with rpl_master=default, script='replication/replica_auth.lua'")
test_run:cmd("start server replica_auth with args='admin:111 0.1'")
test_run:switch('replica_auth')
i = box.info
i.replication[i.id % 2 + 1].upstream.status == 'follow' or i
test_run:switch('default')
test_run:cmd("stop server replica_auth")
test_run:cmd("cleanup server replica_auth")
test_run:cmd("delete server replica_auth")

box.schema.user.passwd('admin', '')
box.schema.user.revoke('admin', 'replication')