Skip to content

Commit

Permalink
UIU-3114-add permission checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Terala-Priyanka committed May 7, 2024
1 parent 34f956c commit c4b5c42
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
7 changes: 6 additions & 1 deletion src/routes/UserRecordContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,12 @@ class UserRecordContainer extends React.Component {
},
userReadingRoomPermissions: {
type: 'okapi',
path: 'reading-room-patron-permission/:{id}'
// eslint-disable-next-line consistent-return
path: (queryParams, pathComponents, resourceData, config, props) => {
if (props.stripes.hasPerm('reading-room-patron-permission.item.get')) {
return `reading-room-patron-permission/${pathComponents.id}`;
}
}
}
});

Expand Down
14 changes: 8 additions & 6 deletions src/views/UserDetail/UserDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -778,12 +778,14 @@ class UserDetail extends React.Component {
/>
{
displayReadingRoomAccessAccordion && (
<ReadingRoomAccess
accordionId="readingRoomAccessSection"
onToggle={this.handleSectionToggle}
expanded={sections.readingRoomAccessSection}
userRRAPermissions={userRRAPermissions}
/>
<IfPermission perm="ui-users.view-reading-room-access">
<ReadingRoomAccess
accordionId="readingRoomAccessSection"
onToggle={this.handleSectionToggle}
expanded={sections.readingRoomAccessSection}
userRRAPermissions={userRRAPermissions}
/>
</IfPermission>
)
}

Expand Down

0 comments on commit c4b5c42

Please sign in to comment.