Skip to content

Commit

Permalink
Merge branch 'gh-4594-perms-bugs-and-enhancements_7.6' of github.com-…
Browse files Browse the repository at this point in the history
…at055612:gchq/stroom into gh-4594-perms-bugs-and-enhancements_7.6
  • Loading branch information
at055612 committed Dec 9, 2024
2 parents 1af5428 + bc363c0 commit 5692ec6
Show file tree
Hide file tree
Showing 10 changed files with 599 additions and 527 deletions.
38 changes: 35 additions & 3 deletions stroom-app/src/main/resources/ui/noauth/swagger/stroom.json
Original file line number Diff line number Diff line change
Expand Up @@ -10330,6 +10330,31 @@
}
},
"/users/v1/{userUuid}" : {
"delete" : {
"operationId" : "deleteUser",
"parameters" : [ {
"in" : "path",
"name" : "userUuid",
"required" : true,
"schema" : {
"type" : "string"
}
} ],
"responses" : {
"default" : {
"content" : {
"application/json" : {
"schema" : {
"type" : "boolean"
}
}
},
"description" : "default response"
}
},
"summary" : "Delete the user with the supplied UUID",
"tags" : [ "Authorisation" ]
},
"get" : {
"operationId" : "fetchUser",
"parameters" : [ {
Expand Down Expand Up @@ -11086,9 +11111,6 @@
"AdvancedDocumentFindWithPermissionsRequest" : {
"type" : "object",
"properties" : {
"explicitPermission" : {
"type" : "boolean"
},
"expression" : {
"$ref" : "#/components/schemas/ExpressionOperator"
},
Expand All @@ -11103,6 +11125,10 @@
},
"uniqueItems" : true
},
"showLevel" : {
"type" : "string",
"enum" : [ "SHOW_EXPLICIT", "SHOW_EFFECTIVE", "SHOW_ALL" ]
},
"sort" : {
"type" : "string",
"writeOnly" : true
Expand Down Expand Up @@ -14295,6 +14321,9 @@
"items" : {
"$ref" : "#/components/schemas/CriteriaFieldSort"
}
},
"userRef" : {
"$ref" : "#/components/schemas/UserRef"
}
}
},
Expand Down Expand Up @@ -14376,6 +14405,9 @@
"items" : {
"$ref" : "#/components/schemas/CriteriaFieldSort"
}
},
"userRef" : {
"$ref" : "#/components/schemas/UserRef"
}
}
},
Expand Down
30 changes: 28 additions & 2 deletions stroom-app/src/main/resources/ui/noauth/swagger/stroom.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7089,6 +7089,24 @@ paths:
tags:
- Authorisation
/users/v1/{userUuid}:
delete:
operationId: deleteUser
parameters:
- in: path
name: userUuid
required: true
schema:
type: string
responses:
default:
content:
application/json:
schema:
type: boolean
description: default response
summary: Delete the user with the supplied UUID
tags:
- Authorisation
get:
operationId: fetchUser
parameters:
Expand Down Expand Up @@ -7645,8 +7663,6 @@ components:
AdvancedDocumentFindWithPermissionsRequest:
type: object
properties:
explicitPermission:
type: boolean
expression:
$ref: '#/components/schemas/ExpressionOperator'
pageRequest:
Expand All @@ -7662,6 +7678,12 @@ components:
- VIEW
- USE
uniqueItems: true
showLevel:
type: string
enum:
- SHOW_EXPLICIT
- SHOW_EFFECTIVE
- SHOW_ALL
sort:
type: string
writeOnly: true
Expand Down Expand Up @@ -10503,6 +10525,8 @@ components:
type: array
items:
$ref: '#/components/schemas/CriteriaFieldSort'
userRef:
$ref: '#/components/schemas/UserRef'
FetchDataRequest:
type: object
properties:
Expand Down Expand Up @@ -10571,6 +10595,8 @@ components:
type: array
items:
$ref: '#/components/schemas/CriteriaFieldSort'
userRef:
$ref: '#/components/schemas/UserRef'
FetchExplorerNodeResult:
type: object
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import stroom.query.api.v2.ExpressionOperator;
import stroom.util.shared.CriteriaFieldSort;
import stroom.util.shared.PageRequest;
import stroom.util.shared.UserRef;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
Expand All @@ -31,42 +32,54 @@
@JsonInclude(Include.NON_NULL)
public class FetchAppUserPermissionsRequest extends ExpressionCriteria {

@JsonProperty
private final UserRef userRef;
@JsonProperty
private final PermissionShowLevel showLevel;

@JsonCreator
public FetchAppUserPermissionsRequest(@JsonProperty("pageRequest") final PageRequest pageRequest,
@JsonProperty("sortList") final List<CriteriaFieldSort> sortList,
@JsonProperty("expression") final ExpressionOperator expression,
@JsonProperty("userRef") final UserRef userRef,
@JsonProperty("showLevel") PermissionShowLevel showLevel) {
super(pageRequest, sortList, expression);
this.userRef = userRef;
this.showLevel = showLevel;
}

public UserRef getUserRef() {
return userRef;
}

public PermissionShowLevel getShowLevel() {
return showLevel;
}


// --------------------------------------------------------------------------------


public static class Builder extends AbstractBuilder<FetchAppUserPermissionsRequest, Builder> {

private UserRef userRef;
private PermissionShowLevel showLevel;

public Builder() {

}

public Builder(final FetchAppUserPermissionsRequest expressionCriteria) {
super(expressionCriteria);
this.showLevel = expressionCriteria.showLevel;
public Builder(final FetchAppUserPermissionsRequest request) {
super(request);
this.userRef = request.userRef;
this.showLevel = request.showLevel;
}

public Builder userRef(final UserRef userRef) {
this.userRef = userRef;
return self();
}

public Builder showLevel(final PermissionShowLevel showLevel) {
this.showLevel = showLevel;
return this;
return self();
}

@Override
Expand All @@ -80,6 +93,7 @@ public FetchAppUserPermissionsRequest build() {
pageRequest,
sortList,
expression,
userRef,
showLevel);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,17 @@ public Builder(final FetchDocumentUserPermissionsRequest request) {

public Builder docRef(final DocRef docRef) {
this.docRef = docRef;
return this;
return self();
}

public Builder userRef(final UserRef userRef) {
this.userRef = userRef;
return this;
return self();
}

public Builder showLevel(final PermissionShowLevel showLevel) {
this.showLevel = showLevel;
return this;
return self();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ ResultPage<UserDependency> findDependencies(

@DELETE
@Path("{userUuid}")
@Operation(
summary = "Delete the user with the supplied UUID",
operationId = "deleteUser")
@NotNull
boolean delete(@PathParam("userUuid") String userUuid);

Expand Down
Loading

0 comments on commit 5692ec6

Please sign in to comment.