PermissionsManagerTests.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784
  1. const sinon = require('sinon')
  2. const { expect } = require('chai')
  3. const modulePath =
  4. '../../../../app/src/Features/Authorization/PermissionsManager.js'
  5. const SandboxedModule = require('sandboxed-module')
  6. const { ForbiddenError } = require('../../../../app/src/Features/Errors/Errors')
  7. describe('PermissionsManager', function () {
  8. beforeEach(function () {
  9. this.PermissionsManager = SandboxedModule.require(modulePath, {
  10. requires: {
  11. '../../infrastructure/Modules': (this.Modules = {
  12. promises: {
  13. hooks: {
  14. fire: (this.hooksFire = sinon.stub().resolves([[]])),
  15. },
  16. },
  17. }),
  18. },
  19. })
  20. this.PermissionsManager.registerCapability('capability1', {
  21. default: true,
  22. })
  23. this.PermissionsManager.registerCapability('capability2', {
  24. default: true,
  25. })
  26. this.PermissionsManager.registerCapability('capability3', {
  27. default: true,
  28. })
  29. this.PermissionsManager.registerCapability('capability4', {
  30. default: false,
  31. })
  32. this.PermissionsManager.registerPolicy('openPolicy', {
  33. capability1: true,
  34. capability2: true,
  35. })
  36. this.PermissionsManager.registerPolicy('restrictivePolicy', {
  37. capability1: true,
  38. capability2: false,
  39. })
  40. this.openPolicyResponseSet = [
  41. [
  42. {
  43. managedUsersEnabled: true,
  44. groupPolicy: { openPolicy: true },
  45. },
  46. {
  47. managedUsersEnabled: true,
  48. groupPolicy: { openPolicy: true },
  49. },
  50. ],
  51. ]
  52. this.restrictivePolicyResponseSet = [
  53. [
  54. {
  55. managedUsersEnabled: true,
  56. groupPolicy: { openPolicy: true },
  57. },
  58. {
  59. managedUsersEnabled: true,
  60. groupPolicy: { restrictivePolicy: true },
  61. },
  62. ],
  63. ]
  64. })
  65. describe('hasPermission', function () {
  66. describe('when no policies apply to the user', function () {
  67. it('should return true if default permission is true', function () {
  68. const groupPolicy = {}
  69. const capability = 'capability1'
  70. const result = this.PermissionsManager.hasPermission(
  71. groupPolicy,
  72. capability
  73. )
  74. expect(result).to.be.true
  75. })
  76. it('should return false if the default permission is false', function () {
  77. const groupPolicy = {}
  78. const capability = 'capability4'
  79. const result = this.PermissionsManager.hasPermission(
  80. groupPolicy,
  81. capability
  82. )
  83. expect(result).to.be.false
  84. })
  85. })
  86. describe('when a policy applies to the user', function () {
  87. it('should return true if the user has the capability after the policy is applied', function () {
  88. this.PermissionsManager.registerPolicy('policy', {
  89. capability1: true,
  90. capability2: false,
  91. })
  92. const groupPolicy = {
  93. policy: true,
  94. }
  95. const capability = 'capability1'
  96. const result = this.PermissionsManager.hasPermission(
  97. groupPolicy,
  98. capability
  99. )
  100. expect(result).to.be.true
  101. })
  102. it('should return false if the user does not have the capability after the policy is applied', function () {
  103. this.PermissionsManager.registerPolicy('policy', {
  104. capability1: true,
  105. capability2: false,
  106. })
  107. const groupPolicy = {
  108. policy: true,
  109. }
  110. const capability = 'capability2'
  111. const result = this.PermissionsManager.hasPermission(
  112. groupPolicy,
  113. capability
  114. )
  115. expect(result).to.be.false
  116. })
  117. it('should return the default permission if the policy does not apply to the capability', function () {
  118. this.PermissionsManager.registerPolicy('policy', {
  119. capability1: true,
  120. capability2: false,
  121. })
  122. const groupPolicy = {
  123. policy: true,
  124. }
  125. {
  126. const capability = 'capability3'
  127. const result = this.PermissionsManager.hasPermission(
  128. groupPolicy,
  129. capability
  130. )
  131. expect(result).to.be.true
  132. }
  133. {
  134. const capability = 'capability4'
  135. const result = this.PermissionsManager.hasPermission(
  136. groupPolicy,
  137. capability
  138. )
  139. expect(result).to.be.false
  140. }
  141. })
  142. it('should return the default permission if the policy is not enforced', function () {
  143. this.PermissionsManager.registerPolicy('policy', {
  144. capability1: true,
  145. capability2: false,
  146. })
  147. const groupPolicy = {
  148. policy: false,
  149. }
  150. const capability1 = 'capability1'
  151. const result1 = this.PermissionsManager.hasPermission(
  152. groupPolicy,
  153. capability1
  154. )
  155. const capability2 = 'capability2'
  156. const result2 = this.PermissionsManager.hasPermission(
  157. groupPolicy,
  158. capability2
  159. )
  160. expect(result1).to.be.true
  161. expect(result2).to.be.true
  162. })
  163. })
  164. describe('when multiple policies apply to the user', function () {
  165. it('should return true if all policies allow the capability', function () {
  166. this.PermissionsManager.registerPolicy('policy1', {
  167. capability1: true,
  168. capability2: true,
  169. })
  170. this.PermissionsManager.registerPolicy('policy2', {
  171. capability1: true,
  172. capability2: true,
  173. })
  174. const groupPolicy = {
  175. policy1: true,
  176. policy2: true,
  177. }
  178. const capability = 'capability1'
  179. const result = this.PermissionsManager.hasPermission(
  180. groupPolicy,
  181. capability
  182. )
  183. expect(result).to.be.true
  184. })
  185. it('should return false if any policy denies the capability', function () {
  186. this.PermissionsManager.registerPolicy('policy1', {
  187. capability1: true,
  188. capability2: true,
  189. })
  190. this.PermissionsManager.registerPolicy('policy2', {
  191. capability1: false,
  192. capability2: true,
  193. })
  194. const groupPolicy = {
  195. policy1: true,
  196. policy2: true,
  197. }
  198. const capability = 'capability1'
  199. const result = this.PermissionsManager.hasPermission(
  200. groupPolicy,
  201. capability
  202. )
  203. expect(result).to.be.false
  204. })
  205. it('should return the default permssion when the applicable policy is not enforced', function () {
  206. this.PermissionsManager.registerPolicy('policy1', {
  207. capability1: true,
  208. capability2: true,
  209. })
  210. this.PermissionsManager.registerPolicy('policy2', {
  211. capability1: false,
  212. capability2: true,
  213. })
  214. const groupPolicy = {
  215. policy1: true,
  216. policy2: false,
  217. }
  218. const capability = 'capability1'
  219. const result = this.PermissionsManager.hasPermission(
  220. groupPolicy,
  221. capability
  222. )
  223. expect(result).to.be.true
  224. })
  225. it('should return the default permission if the policies do not restrict to the capability', function () {
  226. this.PermissionsManager.registerPolicy('policy', {
  227. capability1: true,
  228. capability2: false,
  229. })
  230. const groupPolicy = {
  231. policy: true,
  232. }
  233. {
  234. const capability = 'capability3'
  235. const result = this.PermissionsManager.hasPermission(
  236. groupPolicy,
  237. capability
  238. )
  239. expect(result).to.be.true
  240. }
  241. {
  242. const capability = 'capability4'
  243. const result = this.PermissionsManager.hasPermission(
  244. groupPolicy,
  245. capability
  246. )
  247. expect(result).to.be.false
  248. }
  249. })
  250. })
  251. })
  252. describe('getUserCapabilities', function () {
  253. it('should return the default capabilities when no group policy is provided', function () {
  254. const groupPolicy = {}
  255. const capabilities =
  256. this.PermissionsManager.getUserCapabilities(groupPolicy)
  257. expect(capabilities).to.deep.equal(
  258. new Set(['capability1', 'capability2', 'capability3'])
  259. )
  260. })
  261. it('should return a reduced capability set when a group policy is provided', function () {
  262. this.PermissionsManager.registerPolicy('policy', {
  263. capability1: true,
  264. capability2: false,
  265. })
  266. const groupPolicy = {
  267. policy: true,
  268. }
  269. const capabilities =
  270. this.PermissionsManager.getUserCapabilities(groupPolicy)
  271. expect(capabilities).to.deep.equal(
  272. new Set(['capability1', 'capability3'])
  273. )
  274. })
  275. it('should return a reduced capability set when multiple group policies are provided', function () {
  276. this.PermissionsManager.registerPolicy('policy1', {
  277. capability1: true,
  278. capability2: false,
  279. })
  280. this.PermissionsManager.registerPolicy('policy2', {
  281. capability1: false,
  282. capability2: true,
  283. })
  284. const groupPolicy = {
  285. policy1: true,
  286. policy2: true,
  287. }
  288. const capabilities =
  289. this.PermissionsManager.getUserCapabilities(groupPolicy)
  290. expect(capabilities).to.deep.equal(new Set(['capability3']))
  291. })
  292. it('should return an empty capability set when group policies remove all permissions', function () {
  293. this.PermissionsManager.registerPolicy('policy1', {
  294. capability1: true,
  295. capability2: false,
  296. })
  297. this.PermissionsManager.registerPolicy('policy2', {
  298. capability1: false,
  299. capability2: true,
  300. })
  301. this.PermissionsManager.registerPolicy('policy3', {
  302. capability1: true,
  303. capability2: true,
  304. capability3: false,
  305. })
  306. const groupPolicy = {
  307. policy1: true,
  308. policy2: true,
  309. policy3: true,
  310. }
  311. const capabilities =
  312. this.PermissionsManager.getUserCapabilities(groupPolicy)
  313. expect(capabilities).to.deep.equal(new Set())
  314. })
  315. })
  316. describe('getUserValidationStatus', function () {
  317. it('should return the status for the policy when the user conforms', async function () {
  318. this.PermissionsManager.registerPolicy(
  319. 'policy',
  320. {},
  321. {
  322. validator: async ({ user, subscription }) => {
  323. return user.prop === 'allowed' && subscription.prop === 'managed'
  324. },
  325. }
  326. )
  327. const groupPolicy = {
  328. policy: true,
  329. }
  330. const user = { prop: 'allowed' }
  331. const subscription = { prop: 'managed' }
  332. const result =
  333. await this.PermissionsManager.promises.getUserValidationStatus({
  334. user,
  335. groupPolicy,
  336. subscription,
  337. })
  338. expect(result).to.deep.equal(new Map([['policy', true]]))
  339. })
  340. it('should return the status for the policy when the user does not conform', async function () {
  341. this.PermissionsManager.registerPolicy(
  342. 'policy',
  343. {},
  344. {
  345. validator: async ({ user, subscription }) => {
  346. return user.prop === 'allowed' && subscription.prop === 'managed'
  347. },
  348. }
  349. )
  350. const groupPolicy = {
  351. policy: true,
  352. }
  353. const user = { prop: 'not allowed' }
  354. const subscription = { prop: 'managed' }
  355. const result =
  356. await this.PermissionsManager.promises.getUserValidationStatus({
  357. user,
  358. groupPolicy,
  359. subscription,
  360. })
  361. expect(result).to.deep.equal(new Map([['policy', false]]))
  362. })
  363. it('should return the status for multiple policies according to whether the user conforms', async function () {
  364. this.PermissionsManager.registerPolicy(
  365. 'policy1',
  366. {},
  367. {
  368. validator: async ({ user, subscription }) => {
  369. return user.prop === 'allowed' && subscription.prop === 'managed'
  370. },
  371. }
  372. )
  373. this.PermissionsManager.registerPolicy(
  374. 'policy2',
  375. {},
  376. {
  377. validator: async ({ user, subscription }) => {
  378. return user.prop === 'other' && subscription.prop === 'managed'
  379. },
  380. }
  381. )
  382. this.PermissionsManager.registerPolicy(
  383. 'policy3',
  384. {},
  385. {
  386. validator: async ({ user, subscription }) => {
  387. return user.prop === 'allowed' && subscription.prop === 'managed'
  388. },
  389. }
  390. )
  391. const groupPolicy = {
  392. policy1: true,
  393. policy2: true,
  394. policy3: false, // this policy is not enforced
  395. }
  396. const user = { prop: 'allowed' }
  397. const subscription = { prop: 'managed' }
  398. const result =
  399. await this.PermissionsManager.promises.getUserValidationStatus({
  400. user,
  401. groupPolicy,
  402. subscription,
  403. })
  404. expect(result).to.deep.equal(
  405. new Map([
  406. ['policy1', true],
  407. ['policy2', false],
  408. ])
  409. )
  410. })
  411. })
  412. describe('assertUserPermissions', function () {
  413. describe('allowed', function () {
  414. it('should not error when managedUsersEnabled is not enabled for user', async function () {
  415. const result =
  416. await this.PermissionsManager.promises.assertUserPermissions(
  417. { _id: 'user123' },
  418. ['add-secondary-email']
  419. )
  420. expect(result).to.be.undefined
  421. })
  422. it('should not error when default capability is true', async function () {
  423. this.PermissionsManager.registerCapability('some-policy-to-check', {
  424. default: true,
  425. })
  426. this.hooksFire.resolves([
  427. [
  428. {
  429. managedUsersEnabled: true,
  430. groupPolicy: {},
  431. },
  432. ],
  433. ])
  434. const result =
  435. await this.PermissionsManager.promises.assertUserPermissions(
  436. { _id: 'user123' },
  437. ['some-policy-to-check']
  438. )
  439. expect(result).to.be.undefined
  440. })
  441. it('should not error when default permission is false but user has permission', async function () {
  442. this.PermissionsManager.registerCapability('some-policy-to-check', {
  443. default: false,
  444. })
  445. this.PermissionsManager.registerPolicy('userCanDoSomePolicy', {
  446. 'some-policy-to-check': true,
  447. })
  448. this.hooksFire.resolves([
  449. [
  450. {
  451. managedUsersEnabled: true,
  452. groupPolicy: {
  453. userCanDoSomePolicy: true,
  454. },
  455. },
  456. ],
  457. ])
  458. const result =
  459. await this.PermissionsManager.promises.assertUserPermissions(
  460. { _id: 'user123' },
  461. ['some-policy-to-check']
  462. )
  463. expect(result).to.be.undefined
  464. })
  465. })
  466. describe('not allowed', function () {
  467. it('should return error when managedUsersEnabled is enabled for user but there is no group policy', async function () {
  468. this.hooksFire.resolves([[{ managedUsersEnabled: true }]])
  469. await expect(
  470. this.PermissionsManager.promises.assertUserPermissions(
  471. { _id: 'user123' },
  472. ['add-secondary-email']
  473. )
  474. ).to.be.rejectedWith(Error, 'unknown capability: add-secondary-email')
  475. })
  476. it('should return error when default permission is false', async function () {
  477. this.PermissionsManager.registerCapability('some-policy-to-check', {
  478. default: false,
  479. })
  480. this.hooksFire.resolves([
  481. [
  482. {
  483. managedUsersEnabled: true,
  484. groupPolicy: {},
  485. },
  486. ],
  487. ])
  488. await expect(
  489. this.PermissionsManager.promises.assertUserPermissions(
  490. { _id: 'user123' },
  491. ['some-policy-to-check']
  492. )
  493. ).to.be.rejectedWith(ForbiddenError)
  494. })
  495. it('should return error when default permission is true but user does not have permission', async function () {
  496. this.PermissionsManager.registerCapability('some-policy-to-check', {
  497. default: true,
  498. })
  499. this.PermissionsManager.registerPolicy('userCannotDoSomePolicy', {
  500. 'some-policy-to-check': false,
  501. })
  502. this.hooksFire.resolves([
  503. [
  504. {
  505. managedUsersEnabled: true,
  506. groupPolicy: { userCannotDoSomePolicy: true },
  507. },
  508. ],
  509. ])
  510. await expect(
  511. this.PermissionsManager.promises.assertUserPermissions(
  512. { _id: 'user123' },
  513. ['some-policy-to-check']
  514. )
  515. ).to.be.rejectedWith(ForbiddenError)
  516. })
  517. })
  518. })
  519. describe('registerAllowedProperty', function () {
  520. it('allows us to register a property', async function () {
  521. this.PermissionsManager.registerAllowedProperty('metadata1')
  522. const result = await this.PermissionsManager.getAllowedProperties()
  523. expect(result).to.deep.equal(new Set(['metadata1']))
  524. })
  525. // used if multiple modules would require the same prop, since we dont know which will load first, both must register
  526. it('should handle multiple registrations of the same property', async function () {
  527. this.PermissionsManager.registerAllowedProperty('metadata1')
  528. this.PermissionsManager.registerAllowedProperty('metadata1')
  529. const result = await this.PermissionsManager.getAllowedProperties()
  530. expect(result).to.deep.equal(new Set(['metadata1']))
  531. })
  532. })
  533. describe('combineAllowedProperties', function () {
  534. it('should handle multiple occurences of the same property, preserving the first occurence', async function () {
  535. const policy1 = {
  536. groupPolicy: {
  537. policy: false,
  538. },
  539. prop1: 'some other value here',
  540. }
  541. const policy2 = {
  542. groupPolicy: {
  543. policy: false,
  544. },
  545. prop1: 'some value here',
  546. }
  547. const results = [policy1, policy2]
  548. this.PermissionsManager.registerAllowedProperty('prop1')
  549. const combinedProps =
  550. this.PermissionsManager.combineAllowedProperties(results)
  551. expect(combinedProps).to.deep.equal({
  552. prop1: 'some other value here',
  553. })
  554. })
  555. it('should add registered properties to the set', async function () {
  556. const policy = {
  557. groupPolicy: {
  558. policy: false,
  559. },
  560. prop1: 'some value here',
  561. propNotMeThough: 'dont copy please',
  562. }
  563. const policy2 = {
  564. groupPolicy: {
  565. policy: false,
  566. },
  567. prop2: 'some value here',
  568. }
  569. const results = [policy, policy2]
  570. this.PermissionsManager.registerAllowedProperty('prop1')
  571. this.PermissionsManager.registerAllowedProperty('prop2')
  572. const combinedProps =
  573. this.PermissionsManager.combineAllowedProperties(results)
  574. expect(combinedProps).to.deep.equal({
  575. prop1: 'some value here',
  576. prop2: 'some value here',
  577. })
  578. })
  579. it('should not add unregistered properties to the req object', async function () {
  580. const policy = {
  581. groupPolicy: {
  582. policy: false,
  583. },
  584. prop1: 'some value here',
  585. }
  586. const policy2 = {
  587. groupPolicy: {
  588. policy: false,
  589. },
  590. prop2: 'some value here',
  591. }
  592. this.PermissionsManager.registerAllowedProperty('prop1')
  593. const results = [policy, policy2]
  594. const combinedProps =
  595. this.PermissionsManager.combineAllowedProperties(results)
  596. expect(combinedProps).to.deep.equal({ prop1: 'some value here' })
  597. })
  598. it('should handle an empty array', async function () {
  599. const results = []
  600. const combinedProps =
  601. this.PermissionsManager.combineAllowedProperties(results)
  602. expect(combinedProps).to.deep.equal({})
  603. })
  604. })
  605. describe('combineGroupPolicies', function () {
  606. it('should return an empty object when an empty array is passed', async function () {
  607. const results = []
  608. const combinedPolicy =
  609. this.PermissionsManager.combineGroupPolicies(results)
  610. expect(combinedPolicy).to.deep.equal({})
  611. })
  612. it('should combine multiple group policies into a single policy object', async function () {
  613. const groupPolicy = {
  614. policy1: true,
  615. }
  616. const groupPolicy2 = {
  617. policy2: false,
  618. policy3: true,
  619. }
  620. this.PermissionsManager.registerAllowedProperty('prop1')
  621. const results = [groupPolicy, groupPolicy2]
  622. const combinedPolicy =
  623. this.PermissionsManager.combineGroupPolicies(results)
  624. expect(combinedPolicy).to.deep.equal({
  625. policy1: true,
  626. policy3: true,
  627. })
  628. })
  629. it('should handle duplicate enforced policies across different group policies', async function () {
  630. const groupPolicy = {
  631. policy1: false,
  632. policy2: true,
  633. }
  634. const groupPolicy2 = {
  635. policy2: true,
  636. policy3: true,
  637. }
  638. this.PermissionsManager.registerAllowedProperty('prop1')
  639. const results = [groupPolicy, groupPolicy2]
  640. const combinedPolicy =
  641. this.PermissionsManager.combineGroupPolicies(results)
  642. expect(combinedPolicy).to.deep.equal({
  643. policy2: true,
  644. policy3: true,
  645. })
  646. })
  647. it('should handle group policies with no enforced policies', async function () {
  648. const groupPolicy = {
  649. policy1: false,
  650. policy2: false,
  651. }
  652. const groupPolicy2 = {
  653. policy2: false,
  654. policy3: true,
  655. }
  656. this.PermissionsManager.registerAllowedProperty('prop1')
  657. const results = [groupPolicy, groupPolicy2]
  658. const combinedPolicy =
  659. this.PermissionsManager.combineGroupPolicies(results)
  660. expect(combinedPolicy).to.deep.equal({ policy3: true })
  661. })
  662. it('should choose the stricter option between two policy values', async function () {
  663. const groupPolicy = {
  664. policy1: false,
  665. policy2: true,
  666. policy4: true,
  667. }
  668. const groupPolicy2 = {
  669. policy2: false,
  670. policy3: true,
  671. policy4: false,
  672. }
  673. this.PermissionsManager.registerAllowedProperty('prop1')
  674. const results = [groupPolicy, groupPolicy2]
  675. const combinedPolicy =
  676. this.PermissionsManager.combineGroupPolicies(results)
  677. expect(combinedPolicy).to.deep.equal({
  678. policy2: true,
  679. policy3: true,
  680. policy4: true,
  681. })
  682. })
  683. })
  684. describe('checkUserListPermissions', function () {
  685. it('should return true when all users have permissions required', async function () {
  686. const userList = ['user1', 'user2', 'user3']
  687. const capabilities = ['capability1', 'capability2']
  688. this.hooksFire.onCall(0).resolves(this.openPolicyResponseSet)
  689. this.hooksFire.onCall(1).resolves(this.openPolicyResponseSet)
  690. this.hooksFire.onCall(2).resolves(this.openPolicyResponseSet)
  691. const usersHavePermission =
  692. await this.PermissionsManager.promises.checkUserListPermissions(
  693. userList,
  694. capabilities
  695. )
  696. expect(usersHavePermission).to.equal(true)
  697. })
  698. it('should return false if any user does not have permission', async function () {
  699. const userList = ['user1', 'user2', 'user3']
  700. const capabilities = ['capability1', 'capability2']
  701. this.hooksFire.onCall(0).resolves(this.openPolicyResponseSet)
  702. this.hooksFire.onCall(1).resolves(this.restrictivePolicyResponseSet)
  703. this.hooksFire.onCall(2).resolves(this.openPolicyResponseSet)
  704. const usersHavePermission =
  705. await this.PermissionsManager.promises.checkUserListPermissions(
  706. userList,
  707. capabilities
  708. )
  709. expect(usersHavePermission).to.equal(false)
  710. })
  711. })
  712. })