basic.sim 2.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect

print =============== step0
sql show users
if $data(root)[1] != 1 then
  return -1
endi
if $data(root)[2] != 1 then
  return -1
endi
if $data(root)[3] != 1 then
  return -1
endi

sql alter user root pass 'taosdata'

sql_error ALTER USER root SYSINFO 0
sql_error ALTER USER root SYSINFO 1
sql_error ALTER USER root enable 0
sql_error ALTER USER root enable 1

S
Shengliang Guan 已提交
25
#sql_error create database db vgroups 1;
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
sql_error GRANT read ON db.* to root;
sql_error GRANT read ON *.* to root;
sql_error REVOKE read ON db.* from root;
sql_error REVOKE read ON *.* from root;
sql_error GRANT write ON db.* to root;
sql_error GRANT write ON *.* to root;
sql_error REVOKE write ON db.* from root;
sql_error REVOKE write ON *.* from root;
sql_error REVOKE write ON *.* from root;

sql_error GRANT all ON *.* to root;
sql_error REVOKE all ON *.* from root;
sql_error GRANT read,write ON *.* to root;
sql_error REVOKE read,write ON *.* from root;

print =============== step1: sysinfo create
sql CREATE USER u1 PASS 'taosdata' SYSINFO 0;
sql show users
if $rows != 2 then 
  return -1
endi
if $data(u1)[1] != 0 then
  return -1
endi
if $data(u1)[2] != 1 then
  return -1
endi
if $data(u1)[3] != 0 then
  return -1
endi

sql CREATE USER u2 PASS 'taosdata' SYSINFO 1;
sql show users
if $rows != 3 then 
  return -1
endi
if $data(u2)[1] != 0 then
  return -1
endi
if $data(u2)[2] != 1 then
  return -1
endi
if $data(u2)[3] != 1 then
  return -1
endi

print =============== step2: sysinfo alter
sql ALTER USER u1 SYSINFO 1
sql show users
if $data(u1)[1] != 0 then
  return -1
endi
if $data(u1)[2] != 1 then
  return -1
endi
if $data(u1)[3] != 1 then
  return -1
endi

sql ALTER USER u1 SYSINFO 0
sql show users
if $data(u1)[1] != 0 then
  return -1
endi
if $data(u1)[2] != 1 then
  return -1
endi
if $data(u1)[3] != 0 then
  return -1
endi

sql ALTER USER u1 SYSINFO 0
sql ALTER USER u1 SYSINFO 0

sql drop user u1
sql show users
if $rows != 2 then 
  return -1
endi

print =============== step3: enable alter
sql ALTER USER u2 enable 0
sql show users
if $rows != 2 then 
  return -1
endi
if $data(u2)[1] != 0 then
  return -1
endi
if $data(u2)[2] != 0 then
  return -1
endi
if $data(u2)[3] != 1 then
  return -1
endi

sql ALTER USER u2 enable 1
sql show users
if $data(u2)[1] != 0 then
  return -1
endi
if $data(u2)[2] != 1 then
  return -1
endi
if $data(u2)[3] != 1 then
  return -1
endi

sql ALTER USER u2 enable 1
sql ALTER USER u2 enable 1

print =============== restart taosd
system sh/exec.sh -n dnode1 -s stop
system sh/exec.sh -n dnode1 -s start

print =============== step4: enable privilege
sql show users
if $rows != 2 then 
  return -1
endi
if $data(u2)[1] != 0 then
  return -1
endi
if $data(u2)[2] != 1 then
  return -1
endi
if $data(u2)[3] != 1 then
  return -1
endi


system sh/exec.sh -n dnode1 -s stop -x SIGINT