Skip to content

Commit

Permalink
Removed non-used pages & queries
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Dec 11, 2024
1 parent 9792b46 commit af4c73e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 83 deletions.
2 changes: 0 additions & 2 deletions client/src/pages/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {InvitationForm} from "./InvitationForm";
import {isEmpty} from "../utils/Utils";
import {MissingAttributes} from "./MissingAttributes";
import {Inviter} from "./Inviter";
import {InvitationOverview} from "./InvitationOverview";
import {Application} from "./Application";
import {System} from "./System";

Expand Down Expand Up @@ -100,7 +99,6 @@ export const App = () => {
<Route path="profile/:id?" element={<Profile/>}/>
<Route path="role/:id" element={<RoleForm/>}/>
<Route path="invitation/:id" element={<InvitationForm/>}/>
<Route path="invitations/:tab?" element={<InvitationOverview/>}/>
<Route path="inviter" element={<Inviter/>}/>
<Route path="roles/:id/:tab?" element={<Role/>}/>
<Route path="applications/:manageId" element={<Application/>}/>
Expand Down
68 changes: 0 additions & 68 deletions client/src/pages/InvitationOverview.js

This file was deleted.

3 changes: 1 addition & 2 deletions client/src/tabs/Invitations.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const mineValue = "mine";

export const Invitations = ({
role,
preloadedInvitations,
standAlone = false,
systemView = false,
history = false,
Expand All @@ -42,7 +41,7 @@ export const Invitations = ({
const [filterValue, setFilterValue] = useState(null);

useEffect(() => {
const promise = systemView ? allInvitations() : (isEmpty(role) ? Promise.resolve(preloadedInvitations) : invitationsByRoleId(role.id));
const promise = systemView ? allInvitations() : invitationsByRoleId(role.id);
if (history) {
useAppStore.setState({
breadcrumbPath: [
Expand Down
8 changes: 2 additions & 6 deletions server/src/main/java/access/api/InvitationController.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,8 @@ public ResponseEntity<Invitation> getInvitation(@RequestParam("hash") String has
@GetMapping("all")
public ResponseEntity<List<Invitation>> all(@Parameter(hidden = true) User user) {
LOG.debug("/all invitations");
UserPermissions.assertAuthority(user, Authority.INVITER);
if (user.isSuperUser()) {
return ResponseEntity.ok(invitationRepository.findByStatus(Status.OPEN));
}
List<Role> roles = user.getUserRoles().stream().map(UserRole::getRole).toList();
return ResponseEntity.ok(invitationRepository.findByRoles_roleIsIn(roles));
UserPermissions.assertAuthority(user, Authority.SUPER_USER);
return ResponseEntity.ok(invitationRepository.findByStatus(Status.OPEN));
}


Expand Down
9 changes: 4 additions & 5 deletions server/src/test/java/access/api/InvitationControllerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -566,17 +566,16 @@ void all() throws Exception {
}

@Test
void allByInviter() throws Exception {
void allByInviterNotAllowed() throws Exception {
AccessCookieFilter accessCookieFilter = openIDConnectFlow("/api/v1/users/login", INVITER_SUB);
List<Invitation> invitations = given()
given()
.when()
.filter(accessCookieFilter.cookieFilter())
.accept(ContentType.JSON)
.contentType(ContentType.JSON)
.get("/api/v1/invitations/all")
.as(new TypeRef<>() {
});
assertEquals(2, invitations.size());
.then()
.statusCode(403);
}

@Test
Expand Down

0 comments on commit af4c73e

Please sign in to comment.