Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite5e6e1c

Browse files
committed
Filter audit org dropdown by auditable orgs
1 parent092f585 commite5e6e1c

File tree

1 file changed

+29
-12
lines changed

1 file changed

+29
-12
lines changed

‎site/src/pages/AuditPage/AuditFilter.tsx

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -211,19 +211,36 @@ export const useOrganizationsFilterMenu = ({
211211
returnnull;
212212
},
213213
getOptions:async()=>{
214-
constorganizationsRes=awaitAPI.getOrganizations();
215-
returnorganizationsRes.map<SelectFilterOption>((organization)=>({
216-
label:organization.display_name||organization.name,
217-
value:organization.name,
218-
startIcon:(
219-
<UserAvatar
220-
key={organization.id}
221-
size="xs"
222-
username={organization.display_name||organization.name}
223-
avatarURL={organization.icon}
224-
/>
214+
// Only show the organizations for which you can view audit logs.
215+
constorganizations=awaitAPI.getOrganizations();
216+
constpermissions=awaitAPI.checkAuthorization({
217+
checks:Object.fromEntries(
218+
organizations.map((organization)=>[
219+
organization.id,
220+
{
221+
object:{
222+
resource_type:"audit_log",
223+
organization_id:organization.id,
224+
},
225+
action:"read",
226+
},
227+
]),
225228
),
226-
}));
229+
});
230+
returnorganizations
231+
.filter((organization)=>permissions[organization.id])
232+
.map<SelectFilterOption>((organization)=>({
233+
label:organization.display_name||organization.name,
234+
value:organization.name,
235+
startIcon:(
236+
<UserAvatar
237+
key={organization.id}
238+
size="xs"
239+
username={organization.display_name||organization.name}
240+
avatarURL={organization.icon}
241+
/>
242+
),
243+
}));
227244
},
228245
});
229246
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp