@@ -18,6 +18,9 @@ export class ObjectSummary {
1818 private treeRows : Locator ;
1919 private primaryKeys : Locator ;
2020 private actionsMenu : ActionsMenu ;
21+ private aclWrapper : Locator ;
22+ private aclList : Locator ;
23+ private effectiveAclList : Locator ;
2124
2225 constructor ( page : Page ) {
2326 this . tree = page . locator ( '.ydb-object-summary__tree' ) ;
@@ -26,6 +29,49 @@ export class ObjectSummary {
2629 this . schemaViewer = page . locator ( '.schema-viewer' ) ;
2730 this . primaryKeys = page . locator ( '.schema-viewer__keys_type_primary' ) ;
2831 this . actionsMenu = new ActionsMenu ( page . locator ( '.g-popup.g-popup_open' ) ) ;
32+ this . aclWrapper = page . locator ( '.ydb-acl' ) ;
33+ this . aclList = this . aclWrapper . locator ( 'dl.gc-definition-list' ) . first ( ) ;
34+ this . effectiveAclList = this . aclWrapper . locator ( 'dl.gc-definition-list' ) . last ( ) ;
35+ }
36+
37+ async waitForAclVisible ( ) {
38+ await this . aclWrapper . waitFor ( { state : 'visible' , timeout : VISIBILITY_TIMEOUT } ) ;
39+ return true ;
40+ }
41+
42+ async getAccessRights ( ) : Promise < { user : string ; rights : string } [ ] > {
43+ await this . waitForAclVisible ( ) ;
44+ const items = await this . aclList . locator ( '.gc-definition-list__item' ) . all ( ) ;
45+ const result = [ ] ;
46+
47+ for ( const item of items ) {
48+ const user =
49+ ( await item . locator ( '.gc-definition-list__term-wrapper span' ) . textContent ( ) ) || '' ;
50+ const definitionContent = await item . locator ( '.gc-definition-list__definition' ) . first ( ) ;
51+ const rights = ( await definitionContent . textContent ( ) ) || '' ;
52+ result . push ( { user : user . trim ( ) , rights : rights . trim ( ) } ) ;
53+ }
54+
55+ return result ;
56+ }
57+
58+ async getEffectiveAccessRights ( ) : Promise < { group : string ; permissions : string [ ] } [ ] > {
59+ await this . waitForAclVisible ( ) ;
60+ const items = await this . effectiveAclList . locator ( '.gc-definition-list__item' ) . all ( ) ;
61+ const result = [ ] ;
62+
63+ for ( const item of items ) {
64+ const group =
65+ ( await item . locator ( '.gc-definition-list__term-wrapper span' ) . textContent ( ) ) || '' ;
66+ const definitionContent = await item . locator ( '.gc-definition-list__definition' ) . first ( ) ;
67+ const permissionElements = await definitionContent . locator ( 'span' ) . all ( ) ;
68+ const permissions = await Promise . all (
69+ permissionElements . map ( async ( el ) => ( ( await el . textContent ( ) ) || '' ) . trim ( ) ) ,
70+ ) ;
71+ result . push ( { group : group . trim ( ) , permissions} ) ;
72+ }
73+
74+ return result ;
2975 }
3076
3177 async isTreeVisible ( ) {
0 commit comments