authority.sim 5.2 KB
Newer Older
S
slguan 已提交
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 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 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317
sql connect
sleep 3000

print ============= step1

sql create user read pass 'taosdata'
sql create user write pass 'taosdata'
sql create user manage pass 'taosdata'

sql create user a PASS 'ade' privilege  -x step11
  return -1
step11:

sql create user a PASS 'ade' privilege a -x step12
  return -1
step12:

sql create user a PASS 'ade' privilege read -x step13
  return -1
step13:

sql show users
if $rows != 6 then 
  return -1
endi

sql alter user read privilege read
sql alter user write privilege write
sql alter user manage privilege super

print ============= step2
sql close
sql connect write
sleep 2000

sql create database d1
sql create database d2
sql create table d1.t1 (ts timestamp, i int)
sql create table d2.t2 (ts timestamp, i int)
sql insert into d1.t1 values(now, 1)
sql insert into d2.t2 values(now, 1)
sql insert into d2.t2 values(now+1s, 2)

sql show users
if $rows != 6 then 
  return -1
endi
sql show databases
if $rows != 2 then 
  return -1
endi
sql select * from d1.t1
if $rows != 1 then 
  return -1
endi
sql select * from d2.t2
if $rows != 2 then 
  return -1
endi

sql create account t1 pass 'taosdata' -x step21
  return -1
step21:

sql create user t1 pass 'taosdata' -x step22
  return -1
step22:

sql alter user read pass 'taosdata' -x step23
  return -1
step23:

sql create dnode 192.168.0.2 -x step24
  return -1
step24:

sql drop dnode 192.168.0.2 -x step25
  return -1
step25:

sql create mnode 192.168.0.2 -x step26
  return -1
step26:

sql drop mnode 192.168.0.2 -x step27
  return -1
step27:

sql drop account root -x step28
  return -1 
step28:

sql alter user write pass 'taosdata'

print ============= step3
sql close
sql connect read
sleep 2000

sql create database d3 -x step31
  return -1
step31:

sql create table d1.t3 (ts timestamp, i int) -x step32
  return -1
step32:

#sql insert into d1.t1 values(now, 2) -x step33
#  return -1
#step33:

sql show accounts
if $rows != 1 then 
  return -1
endi
sql show users
if $rows != 6 then 
  return -1
endi
sql show databases
if $rows != 2 then 
  return -1
endi
sql select * from d1.t1
if $rows != 1 then 
  return -1
endi

sql select * from d2.t2
if $rows != 2 then 
  return -1
endi

sql sql create account t1 pass 'taosdata' -x step34
  return -1
step34:

sql sql create user t1 pass 'taosdata' -x step35
  return -1
step35:

print ============= step4
sql close
sql connect manage
sleep 2000

sql create database d3
sql create database d4
sql create table d3.t3 (ts timestamp, i int)
sql create table d4.t4 (ts timestamp, i int)

sql show accounts
if $rows != 1 then 
  return -1
endi
sql show users
if $rows != 6 then 
  return -1
endi
sql show databases
if $rows != 4 then 
  return -1
endi
sql select * from d1.t1
if $rows != 1 then 
  return -1
endi
sql select * from d2.t2
if $rows != 2 then 
  return -1
endi

sql create account other pass 'taosdata'  -x step41
  return -1
step41:  

sql close
sql connect
sleep 2000
sql create account other pass 'taosdata'

print ============= step5
sql close
sql connect other
sleep 2000
sql create user read pass 'taosdata' -x step51
  return -1
step51:
sql create other write pass 'taosdata' -x step52
  return -1
step52:

sql create user oread pass 'taosdata'
sql create user owrite pass 'taosdata'
sql create user omanage pass 'taosdata' 

sql show users
print show users $rows
if $rows != 5 then 
  return -1
endi

sql alter user oread privilege read
sql alter user owrite privilege write
sql alter user oroot privilege super -x step53
  return -1
step53:
sql alter user read privilege read -x step54
  return -1
step54:

print ============= step6
sql close
sql connect owrite
sleep 2000

sql create database d1
sql create database d3
sql create table d1.t1 (ts timestamp, i int)
sql create table d3.t3 (ts timestamp, i int)
sql insert into d1.t1 values(now, 11)
sql insert into d3.t3 values(now, 11)
sql insert into d3.t3 values(now+1s, 12)

sql show databases
if $rows != 2 then 
  return -1
endi
sql select * from d1.t1
if $rows != 1 then 
  return -1
endi
sql select * from d2.t2 -x step6
  return -1
step6:
sql select * from d3.t3
if $rows != 2 then 
  return -1
endi

sql sql create user t1 pass 'taosdata' -x step62
  return -1
step62:

print ============= step7
sql close
sql connect oread
sleep 2000

sql create database d7 -x step71
  return -1
step71:

sql show databases
if $rows != 2 then 
  return -1
endi
sql select * from d1.t1
if $rows != 1 then 
  return -1
endi
sql select * from d2.t2 -x step72
  return -1
step72:
sql select * from d3.t3
if $rows != 2 then 
  return -1
endi

sql sql create user t1 pass 'taosdata' -x step74
  return -1
step74:

print ============= step8
sql close
sql connect omanage
sleep 2000

sql create database d4
sql create table d4.t4 (ts timestamp, i int)

sql show databases
if $rows != 3 then 
  return -1
endi
sql select * from d1.t1
if $rows != 1 then 
  return -1
endi
sql select * from d2.t2 -x step82
  return -1
step82:
sql select * from d3.t3
if $rows != 2 then 
  return -1
endi

print ============= step9
sql close
sql connect
sleep 2000
sql show databases
if $rows != 4 then 
  return -1
endi

sql drop user read
sql drop user manage
sql drop user write

sql close
sql connect
sleep 2000
sql drop database d1
sql drop database d2
sql drop database d3
sql drop database d4