|
68 | 68 | class SamlTests(testlib.BaseTestSet): |
69 | 69 | # MB-63612: Remove unnecessary Service.KV. It was added only to get rid of |
70 | 70 | # the OnPremAutoFailoverSettingsTest failure. |
71 | | - services_to_run = [Service.KV, Service.QUERY, Service.BACKUP] |
| 71 | + services_to_run = [Service.KV, Service.QUERY, Service.BACKUP, Service.CBAS] |
72 | 72 |
|
73 | 73 | @staticmethod |
74 | 74 | def requirements(): |
@@ -613,6 +613,23 @@ def groups_and_roles_attributes_test(self): |
613 | 613 | bkts.append(x['buckets']['name']) |
614 | 614 | assert bkts == [f'{bucket}'] |
615 | 615 |
|
| 616 | + # MB-62604, MB-63214: cbas doesn't use cbauth. It uses a combination |
| 617 | + # of /pools/default/checkPermissions, /_cbauth/checkPermission. cbas |
| 618 | + # parses cb-on-behalf-extras headers and populates context (similar |
| 619 | + # to cbauth) before calling ns_server /_cbauth/checkPermission. |
| 620 | + |
| 621 | + # Create analytics collection in test._default._default. This will |
| 622 | + # fail - we don't have cluster.analytics!manage. Analytics and full |
| 623 | + # admin roles have the permission (see admin_test). |
| 624 | + r = session.post(self.cluster.connected_nodes[0].url + |
| 625 | + '/_p/cbas/query/service', |
| 626 | + data={'statement': |
| 627 | + 'alter collection ' |
| 628 | + f'`{bucket}`.`_default`.`_default` ' |
| 629 | + 'enable analytics;'}, |
| 630 | + headers=ui_headers) |
| 631 | + assert_http_code(403, r) |
| 632 | + |
616 | 633 | def groups_and_roles_admin_test(self): |
617 | 634 | with saml_configured(self.cluster.connected_nodes[0], |
618 | 635 | groupsAttribute='groups', |
@@ -664,6 +681,24 @@ def groups_and_roles_admin_test(self): |
664 | 681 | headers=ui_headers) |
665 | 682 | assert_http_code(200, r) |
666 | 683 |
|
| 684 | + # Create analytics collection in test._default._default. |
| 685 | + r = session.post(self.cluster.connected_nodes[0].url + |
| 686 | + '/_p/cbas/query/service', |
| 687 | + data={'statement': |
| 688 | + 'alter collection ' |
| 689 | + f'`{bucket}`.`_default`.`_default` ' |
| 690 | + 'enable analytics;'}, |
| 691 | + headers=ui_headers) |
| 692 | + assert_http_code(200, r) |
| 693 | + |
| 694 | + # Query analytics collections. They should exist. |
| 695 | + r = session.post(self.cluster.connected_nodes[0].url + |
| 696 | + '/_p/cbas/query/service', |
| 697 | + data={'statement': |
| 698 | + f'select * from `{bucket}`'}, |
| 699 | + headers=ui_headers) |
| 700 | + assert_http_code(200, r) |
| 701 | + |
667 | 702 | # Successfull authentication, but user doesn't have access to UI |
668 | 703 | def access_denied_test(self): |
669 | 704 | with saml_configured(self.cluster.connected_nodes[0], |
|
0 commit comments