provisioning-v1.feature 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  1. Feature: provisioning
  2. Background:
  3. Given using api version "1"
  4. Scenario: Getting an not existing user
  5. Given As an "admin"
  6. When sending "GET" to "/cloud/users/test"
  7. Then the OCS status code should be "998"
  8. And the HTTP status code should be "200"
  9. Scenario: Listing all users
  10. Given As an "admin"
  11. When sending "GET" to "/cloud/users"
  12. Then the OCS status code should be "100"
  13. And the HTTP status code should be "200"
  14. Scenario: Create a user
  15. Given As an "admin"
  16. And user "brand-new-user" does not exist
  17. When sending "POST" to "/cloud/users" with
  18. | userid | brand-new-user |
  19. | password | 123456 |
  20. Then the OCS status code should be "100"
  21. And the HTTP status code should be "200"
  22. And user "brand-new-user" exists
  23. Scenario: Create an existing user
  24. Given As an "admin"
  25. And user "brand-new-user" exists
  26. When sending "POST" to "/cloud/users" with
  27. | userid | brand-new-user |
  28. | password | 123456 |
  29. Then the OCS status code should be "102"
  30. And the HTTP status code should be "200"
  31. And user "brand-new-user" has
  32. | id | brand-new-user |
  33. | displayname | brand-new-user |
  34. | email | |
  35. | phone | |
  36. | address | |
  37. | website | |
  38. | twitter | |
  39. Scenario: Get an existing user
  40. Given As an "admin"
  41. When sending "GET" to "/cloud/users/brand-new-user"
  42. Then the OCS status code should be "100"
  43. And the HTTP status code should be "200"
  44. Scenario: Getting all users
  45. Given As an "admin"
  46. And user "brand-new-user" exists
  47. And user "admin" exists
  48. When sending "GET" to "/cloud/users"
  49. Then users returned are
  50. | brand-new-user |
  51. | admin |
  52. Scenario: Edit a user
  53. Given As an "admin"
  54. And user "brand-new-user" exists
  55. When sending "PUT" to "/cloud/users/brand-new-user" with
  56. | key | displayname |
  57. | value | Brand New User |
  58. And the OCS status code should be "100"
  59. And the HTTP status code should be "200"
  60. And sending "PUT" to "/cloud/users/brand-new-user" with
  61. | key | quota |
  62. | value | 12MB |
  63. And the OCS status code should be "100"
  64. And the HTTP status code should be "200"
  65. And sending "PUT" to "/cloud/users/brand-new-user" with
  66. | key | email |
  67. | value | brand-new-user@gmail.com |
  68. And the OCS status code should be "100"
  69. And the HTTP status code should be "200"
  70. And sending "PUT" to "/cloud/users/brand-new-user" with
  71. | key | phone |
  72. | value | 0123 456 789 |
  73. And the OCS status code should be "100"
  74. And the HTTP status code should be "200"
  75. And sending "PUT" to "/cloud/users/brand-new-user" with
  76. | key | address |
  77. | value | Foo Bar Town |
  78. And the OCS status code should be "100"
  79. And the HTTP status code should be "200"
  80. And sending "PUT" to "/cloud/users/brand-new-user" with
  81. | key | website |
  82. | value | https://nextcloud.com |
  83. And the OCS status code should be "100"
  84. And the HTTP status code should be "200"
  85. And sending "PUT" to "/cloud/users/brand-new-user" with
  86. | key | twitter |
  87. | value | Nextcloud |
  88. And the OCS status code should be "100"
  89. And the HTTP status code should be "200"
  90. Then user "brand-new-user" has
  91. | id | brand-new-user |
  92. | displayname | Brand New User |
  93. | email | brand-new-user@gmail.com |
  94. | phone | 0123 456 789 |
  95. | address | Foo Bar Town |
  96. | website | https://nextcloud.com |
  97. | twitter | Nextcloud |
  98. Scenario: Create a group
  99. Given As an "admin"
  100. And group "new-group" does not exist
  101. When sending "POST" to "/cloud/groups" with
  102. | groupid | new-group |
  103. | password | 123456 |
  104. Then the OCS status code should be "100"
  105. And the HTTP status code should be "200"
  106. And group "new-group" exists
  107. Scenario: Create a group with special characters
  108. Given As an "admin"
  109. And group "España" does not exist
  110. When sending "POST" to "/cloud/groups" with
  111. | groupid | España |
  112. | password | 123456 |
  113. Then the OCS status code should be "100"
  114. And the HTTP status code should be "200"
  115. And group "España" exists
  116. Scenario: adding user to a group without sending the group
  117. Given As an "admin"
  118. And user "brand-new-user" exists
  119. When sending "POST" to "/cloud/users/brand-new-user/groups" with
  120. | groupid | |
  121. Then the OCS status code should be "101"
  122. And the HTTP status code should be "200"
  123. Scenario: adding user to a group which doesn't exist
  124. Given As an "admin"
  125. And user "brand-new-user" exists
  126. And group "not-group" does not exist
  127. When sending "POST" to "/cloud/users/brand-new-user/groups" with
  128. | groupid | not-group |
  129. Then the OCS status code should be "102"
  130. And the HTTP status code should be "200"
  131. Scenario: adding user to a group without privileges
  132. Given As an "brand-new-user"
  133. When sending "POST" to "/cloud/users/brand-new-user/groups" with
  134. | groupid | new-group |
  135. Then the OCS status code should be "997"
  136. And the HTTP status code should be "401"
  137. Scenario: adding user to a group
  138. Given As an "admin"
  139. And user "brand-new-user" exists
  140. And group "new-group" exists
  141. When sending "POST" to "/cloud/users/brand-new-user/groups" with
  142. | groupid | new-group |
  143. Then the OCS status code should be "100"
  144. And the HTTP status code should be "200"
  145. Scenario: getting groups of an user
  146. Given As an "admin"
  147. And user "brand-new-user" exists
  148. And group "new-group" exists
  149. When sending "GET" to "/cloud/users/brand-new-user/groups"
  150. Then groups returned are
  151. | new-group |
  152. And the OCS status code should be "100"
  153. Scenario: adding a user which doesn't exist to a group
  154. Given As an "admin"
  155. And user "not-user" does not exist
  156. And group "new-group" exists
  157. When sending "POST" to "/cloud/users/not-user/groups" with
  158. | groupid | new-group |
  159. Then the OCS status code should be "103"
  160. And the HTTP status code should be "200"
  161. Scenario: getting a group
  162. Given As an "admin"
  163. And group "new-group" exists
  164. When sending "GET" to "/cloud/groups/new-group"
  165. Then the OCS status code should be "100"
  166. And the HTTP status code should be "200"
  167. Scenario: Getting all groups
  168. Given As an "admin"
  169. And group "new-group" exists
  170. And group "admin" exists
  171. When sending "GET" to "/cloud/groups"
  172. Then groups returned are
  173. | España |
  174. | admin |
  175. | new-group |
  176. Scenario: create a subadmin
  177. Given As an "admin"
  178. And user "brand-new-user" exists
  179. And group "new-group" exists
  180. When sending "POST" to "/cloud/users/brand-new-user/subadmins" with
  181. | groupid | new-group |
  182. Then the OCS status code should be "100"
  183. And the HTTP status code should be "200"
  184. Scenario: get users using a subadmin
  185. Given As an "admin"
  186. And user "brand-new-user" exists
  187. And group "new-group" exists
  188. And user "brand-new-user" belongs to group "new-group"
  189. And user "brand-new-user" is subadmin of group "new-group"
  190. And As an "brand-new-user"
  191. When sending "GET" to "/cloud/users"
  192. Then users returned are
  193. | brand-new-user |
  194. And the OCS status code should be "100"
  195. And the HTTP status code should be "200"
  196. Scenario: removing a user from a group which doesn't exists
  197. Given As an "admin"
  198. And user "brand-new-user" exists
  199. And group "not-group" does not exist
  200. When sending "DELETE" to "/cloud/users/brand-new-user/groups" with
  201. | groupid | not-group |
  202. Then the OCS status code should be "102"
  203. Scenario: removing a user from a group
  204. Given As an "admin"
  205. And user "brand-new-user" exists
  206. And group "new-group" exists
  207. And user "brand-new-user" belongs to group "new-group"
  208. When sending "DELETE" to "/cloud/users/brand-new-user/groups" with
  209. | groupid | new-group |
  210. Then the OCS status code should be "100"
  211. And user "brand-new-user" does not belong to group "new-group"
  212. Scenario: create a subadmin using a user which not exist
  213. Given As an "admin"
  214. And user "not-user" does not exist
  215. And group "new-group" exists
  216. When sending "POST" to "/cloud/users/not-user/subadmins" with
  217. | groupid | new-group |
  218. Then the OCS status code should be "101"
  219. And the HTTP status code should be "200"
  220. Scenario: create a subadmin using a group which not exist
  221. Given As an "admin"
  222. And user "brand-new-user" exists
  223. And group "not-group" does not exist
  224. When sending "POST" to "/cloud/users/brand-new-user/subadmins" with
  225. | groupid | not-group |
  226. Then the OCS status code should be "102"
  227. And the HTTP status code should be "200"
  228. Scenario: Getting subadmin groups
  229. Given As an "admin"
  230. And user "brand-new-user" exists
  231. And group "new-group" exists
  232. When sending "GET" to "/cloud/users/brand-new-user/subadmins"
  233. Then subadmin groups returned are
  234. | new-group |
  235. Then the OCS status code should be "100"
  236. And the HTTP status code should be "200"
  237. Scenario: Getting subadmin groups of a user which not exist
  238. Given As an "admin"
  239. And user "not-user" does not exist
  240. And group "new-group" exists
  241. When sending "GET" to "/cloud/users/not-user/subadmins"
  242. Then the OCS status code should be "101"
  243. And the HTTP status code should be "200"
  244. Scenario: Getting subadmin users of a group
  245. Given As an "admin"
  246. And user "brand-new-user" exists
  247. And group "new-group" exists
  248. When sending "GET" to "/cloud/groups/new-group/subadmins"
  249. Then subadmin users returned are
  250. | brand-new-user |
  251. And the OCS status code should be "100"
  252. And the HTTP status code should be "200"
  253. Scenario: Getting subadmin users of a group which doesn't exist
  254. Given As an "admin"
  255. And user "brand-new-user" exists
  256. And group "not-group" does not exist
  257. When sending "GET" to "/cloud/groups/not-group/subadmins"
  258. Then the OCS status code should be "101"
  259. And the HTTP status code should be "200"
  260. Scenario: Removing subadmin from a group
  261. Given As an "admin"
  262. And user "brand-new-user" exists
  263. And group "new-group" exists
  264. And user "brand-new-user" is subadmin of group "new-group"
  265. When sending "DELETE" to "/cloud/users/brand-new-user/subadmins" with
  266. | groupid | new-group |
  267. And the OCS status code should be "100"
  268. And the HTTP status code should be "200"
  269. Scenario: Delete a user
  270. Given As an "admin"
  271. And user "brand-new-user" exists
  272. When sending "DELETE" to "/cloud/users/brand-new-user"
  273. Then the OCS status code should be "100"
  274. And the HTTP status code should be "200"
  275. And user "brand-new-user" does not exist
  276. Scenario: Delete a group
  277. Given As an "admin"
  278. And group "new-group" exists
  279. When sending "DELETE" to "/cloud/groups/new-group"
  280. Then the OCS status code should be "100"
  281. And the HTTP status code should be "200"
  282. And group "new-group" does not exist
  283. Scenario: Delete a group with special characters
  284. Given As an "admin"
  285. And group "España" exists
  286. When sending "DELETE" to "/cloud/groups/España"
  287. Then the OCS status code should be "100"
  288. And the HTTP status code should be "200"
  289. And group "España" does not exist
  290. Scenario: get enabled apps
  291. Given As an "admin"
  292. When sending "GET" to "/cloud/apps?filter=enabled"
  293. Then the OCS status code should be "100"
  294. And the HTTP status code should be "200"
  295. And apps returned are
  296. | comments |
  297. | dav |
  298. | federatedfilesharing |
  299. | federation |
  300. | files |
  301. | files_sharing |
  302. | files_trashbin |
  303. | files_versions |
  304. | lookup_server_connector |
  305. | provisioning_api |
  306. | sharebymail |
  307. | systemtags |
  308. | theming |
  309. | twofactor_backupcodes |
  310. | updatenotification |
  311. | workflowengine |
  312. | files_external |
  313. | oauth2 |
  314. Scenario: get app info
  315. Given As an "admin"
  316. When sending "GET" to "/cloud/apps/files"
  317. Then the OCS status code should be "100"
  318. And the HTTP status code should be "200"
  319. Scenario: get app info from app that does not exist
  320. Given As an "admin"
  321. When sending "GET" to "/cloud/apps/this_app_should_never_exist"
  322. Then the OCS status code should be "998"
  323. And the HTTP status code should be "200"
  324. Scenario: enable an app
  325. Given As an "admin"
  326. And app "testing" is disabled
  327. When sending "POST" to "/cloud/apps/testing"
  328. Then the OCS status code should be "100"
  329. And the HTTP status code should be "200"
  330. And app "testing" is enabled
  331. Scenario: enable an app that does not exist
  332. Given As an "admin"
  333. When sending "POST" to "/cloud/apps/this_app_should_never_exist"
  334. Then the OCS status code should be "998"
  335. And the HTTP status code should be "200"
  336. Scenario: disable an app
  337. Given As an "admin"
  338. And app "testing" is enabled
  339. When sending "DELETE" to "/cloud/apps/testing"
  340. Then the OCS status code should be "100"
  341. And the HTTP status code should be "200"
  342. And app "testing" is disabled
  343. Scenario: disable an user
  344. Given As an "admin"
  345. And user "user1" exists
  346. When sending "PUT" to "/cloud/users/user1/disable"
  347. Then the OCS status code should be "100"
  348. And the HTTP status code should be "200"
  349. And user "user1" is disabled
  350. Scenario: enable an user
  351. Given As an "admin"
  352. And user "user1" exists
  353. And assure user "user1" is disabled
  354. When sending "PUT" to "/cloud/users/user1/enable"
  355. Then the OCS status code should be "100"
  356. And the HTTP status code should be "200"
  357. And user "user1" is enabled
  358. Scenario: Subadmin should be able to enable or disable an user in their group
  359. Given As an "admin"
  360. And user "subadmin" exists
  361. And user "user1" exists
  362. And group "new-group" exists
  363. And user "subadmin" belongs to group "new-group"
  364. And user "user1" belongs to group "new-group"
  365. And Assure user "subadmin" is subadmin of group "new-group"
  366. And As an "subadmin"
  367. When sending "PUT" to "/cloud/users/user1/disable"
  368. Then the OCS status code should be "100"
  369. Then the HTTP status code should be "200"
  370. And As an "admin"
  371. And user "user1" is disabled
  372. Scenario: Subadmin should not be able to enable or disable an user not in their group
  373. Given As an "admin"
  374. And user "subadmin" exists
  375. And user "user1" exists
  376. And group "new-group" exists
  377. And group "another-group" exists
  378. And user "subadmin" belongs to group "new-group"
  379. And user "user1" belongs to group "another-group"
  380. And Assure user "subadmin" is subadmin of group "new-group"
  381. And As an "subadmin"
  382. When sending "PUT" to "/cloud/users/user1/disable"
  383. Then the OCS status code should be "997"
  384. Then the HTTP status code should be "401"
  385. And As an "admin"
  386. And user "user1" is enabled
  387. Scenario: Subadmins should not be able to disable users that have admin permissions in their group
  388. Given As an "admin"
  389. And user "another-admin" exists
  390. And user "subadmin" exists
  391. And group "new-group" exists
  392. And user "another-admin" belongs to group "admin"
  393. And user "subadmin" belongs to group "new-group"
  394. And user "another-admin" belongs to group "new-group"
  395. And Assure user "subadmin" is subadmin of group "new-group"
  396. And As an "subadmin"
  397. When sending "PUT" to "/cloud/users/another-admin/disable"
  398. Then the OCS status code should be "997"
  399. Then the HTTP status code should be "401"
  400. And As an "admin"
  401. And user "another-admin" is enabled
  402. Scenario: Admin can disable another admin user
  403. Given As an "admin"
  404. And user "another-admin" exists
  405. And user "another-admin" belongs to group "admin"
  406. When sending "PUT" to "/cloud/users/another-admin/disable"
  407. Then the OCS status code should be "100"
  408. Then the HTTP status code should be "200"
  409. And user "another-admin" is disabled
  410. Scenario: Admin can enable another admin user
  411. Given As an "admin"
  412. And user "another-admin" exists
  413. And user "another-admin" belongs to group "admin"
  414. And assure user "another-admin" is disabled
  415. When sending "PUT" to "/cloud/users/another-admin/enable"
  416. Then the OCS status code should be "100"
  417. Then the HTTP status code should be "200"
  418. And user "another-admin" is enabled
  419. Scenario: Admin can disable subadmins in the same group
  420. Given As an "admin"
  421. And user "subadmin" exists
  422. And group "new-group" exists
  423. And user "subadmin" belongs to group "new-group"
  424. And user "admin" belongs to group "new-group"
  425. And Assure user "subadmin" is subadmin of group "new-group"
  426. When sending "PUT" to "/cloud/users/subadmin/disable"
  427. Then the OCS status code should be "100"
  428. Then the HTTP status code should be "200"
  429. And user "subadmin" is disabled
  430. Scenario: Admin can enable subadmins in the same group
  431. Given As an "admin"
  432. And user "subadmin" exists
  433. And group "new-group" exists
  434. And user "subadmin" belongs to group "new-group"
  435. And user "admin" belongs to group "new-group"
  436. And Assure user "subadmin" is subadmin of group "new-group"
  437. And assure user "another-admin" is disabled
  438. When sending "PUT" to "/cloud/users/subadmin/disable"
  439. Then the OCS status code should be "100"
  440. Then the HTTP status code should be "200"
  441. And user "subadmin" is disabled
  442. Scenario: Admin user cannot disable himself
  443. Given As an "admin"
  444. And user "another-admin" exists
  445. And user "another-admin" belongs to group "admin"
  446. And As an "another-admin"
  447. When sending "PUT" to "/cloud/users/another-admin/disable"
  448. Then the OCS status code should be "101"
  449. And the HTTP status code should be "200"
  450. And As an "admin"
  451. And user "another-admin" is enabled
  452. Scenario:Admin user cannot enable himself
  453. Given As an "admin"
  454. And user "another-admin" exists
  455. And user "another-admin" belongs to group "admin"
  456. And assure user "another-admin" is disabled
  457. And As an "another-admin"
  458. When sending "PUT" to "/cloud/users/another-admin/enable"
  459. And As an "admin"
  460. Then user "another-admin" is disabled
  461. Scenario: disable an user with a regular user
  462. Given As an "admin"
  463. And user "user1" exists
  464. And user "user2" exists
  465. And As an "user1"
  466. When sending "PUT" to "/cloud/users/user2/disable"
  467. Then the OCS status code should be "997"
  468. And the HTTP status code should be "401"
  469. And As an "admin"
  470. And user "user2" is enabled
  471. Scenario: enable an user with a regular user
  472. Given As an "admin"
  473. And user "user1" exists
  474. And user "user2" exists
  475. And assure user "user2" is disabled
  476. And As an "user1"
  477. When sending "PUT" to "/cloud/users/user2/enable"
  478. Then the OCS status code should be "997"
  479. And the HTTP status code should be "401"
  480. And As an "admin"
  481. And user "user2" is disabled
  482. Scenario: Subadmin should not be able to disable himself
  483. Given As an "admin"
  484. And user "subadmin" exists
  485. And group "new-group" exists
  486. And user "subadmin" belongs to group "new-group"
  487. And Assure user "subadmin" is subadmin of group "new-group"
  488. And As an "subadmin"
  489. When sending "PUT" to "/cloud/users/subadmin/disable"
  490. Then the OCS status code should be "101"
  491. Then the HTTP status code should be "200"
  492. And As an "admin"
  493. And user "subadmin" is enabled
  494. Scenario: Subadmin should not be able to enable himself
  495. Given As an "admin"
  496. And user "subadmin" exists
  497. And group "new-group" exists
  498. And user "subadmin" belongs to group "new-group"
  499. And Assure user "subadmin" is subadmin of group "new-group"
  500. And assure user "subadmin" is disabled
  501. And As an "subadmin"
  502. When sending "PUT" to "/cloud/users/subadmin/enabled"
  503. And As an "admin"
  504. And user "subadmin" is disabled
  505. Scenario: Making a ocs request with an enabled user
  506. Given As an "admin"
  507. And user "user0" exists
  508. And As an "user0"
  509. When sending "GET" to "/cloud/capabilities"
  510. Then the HTTP status code should be "200"
  511. And the OCS status code should be "100"
  512. Scenario: Making a web request with an enabled user
  513. Given As an "admin"
  514. And user "user0" exists
  515. And As an "user0"
  516. When sending "GET" with exact url to "/index.php/apps/files"
  517. Then the HTTP status code should be "200"
  518. Scenario: Making a ocs request with a disabled user
  519. Given As an "admin"
  520. And user "user0" exists
  521. And assure user "user0" is disabled
  522. And As an "user0"
  523. When sending "GET" to "/cloud/capabilities"
  524. Then the OCS status code should be "997"
  525. And the HTTP status code should be "401"
  526. Scenario: Making a web request with a disabled user
  527. Given As an "admin"
  528. And user "user0" exists
  529. And assure user "user0" is disabled
  530. And As an "user0"
  531. When sending "GET" with exact url to "/index.php/apps/files"
  532. And the HTTP status code should be "403"