mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-02-19 12:10:32 -06:00
graph: Address linting issues
This commit is contained in:
committed by
Ralf Haferkamp
parent
184bd5d0d3
commit
254c9d7c26
@@ -82,7 +82,7 @@ func (g Graph) GetMe(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// expand appRoleAssignments if requested
|
||||
if slices.Contains(exp, "appRoleAssignments") {
|
||||
if slices.Contains(exp, appRoleAssignments) {
|
||||
var err error
|
||||
me.AppRoleAssignments, err = g.fetchAppRoleAssignments(r.Context(), me.GetId())
|
||||
if err != nil {
|
||||
@@ -295,7 +295,7 @@ func (g Graph) GetUsers(w http.ResponseWriter, r *http.Request) {
|
||||
errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
expandAppRoleAssignments := slices.Contains(exp, "appRoleAssignments")
|
||||
expandAppRoleAssignments := slices.Contains(exp, appRoleAssignments)
|
||||
expandMemberOf := slices.Contains(exp, "memberOf")
|
||||
for _, u := range users {
|
||||
if expandAppRoleAssignments && u.AppRoleAssignments == nil {
|
||||
@@ -539,7 +539,7 @@ func (g Graph) GetUser(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// expand appRoleAssignments if requested
|
||||
if slices.Contains(exp, "appRoleAssignments") {
|
||||
if slices.Contains(exp, appRoleAssignments) {
|
||||
user.AppRoleAssignments, err = g.fetchAppRoleAssignments(r.Context(), user.GetId())
|
||||
if err != nil {
|
||||
logger.Debug().Err(err).Str("userid", user.GetId()).Msg("could not get appRoleAssignments for user")
|
||||
|
||||
@@ -11,7 +11,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
appRoleID = "appRoleId"
|
||||
appRoleID = "appRoleId"
|
||||
appRoleAssignments = "appRoleAssignments"
|
||||
)
|
||||
|
||||
func invalidFilterError() error {
|
||||
@@ -237,7 +238,7 @@ func (g Graph) applyFilterLambda(ctx context.Context, req *godata.GoDataRequest,
|
||||
switch nodes[0].Token.Value {
|
||||
case "memberOf":
|
||||
return g.applyLambdaMemberOfAny(ctx, req, nodes[1].Children)
|
||||
case "appRoleAssignments":
|
||||
case appRoleAssignments:
|
||||
return g.applyLambdaAppRoleAssignmentAny(ctx, req, nodes[1].Children)
|
||||
}
|
||||
logger.Debug().Str("Token", nodes[0].Token.Value).Msg("unsupported relation for lambda filter")
|
||||
@@ -349,7 +350,7 @@ func (g Graph) filterUsersByAppRoleID(ctx context.Context, req *godata.GoDataReq
|
||||
var expand bool
|
||||
if exp := req.Query.GetExpand(); exp != nil {
|
||||
for _, item := range exp.ExpandItems {
|
||||
if item.Path[0].Value == "appRoleAssignments" {
|
||||
if item.Path[0].Value == appRoleAssignments {
|
||||
expand = true
|
||||
break
|
||||
}
|
||||
@@ -405,7 +406,7 @@ func (g Graph) isAppRoleAssignmentFilter(ctx context.Context, node *godata.Parse
|
||||
return false, "", ""
|
||||
}
|
||||
|
||||
if node.Children[0].Token.Type != godata.ExpressionTokenLiteral || node.Children[0].Token.Value != "appRoleAssignments" {
|
||||
if node.Children[0].Token.Type != godata.ExpressionTokenLiteral || node.Children[0].Token.Value != appRoleAssignments {
|
||||
return false, "", ""
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user