internal: fix nil pointer reference
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
c72d56d02d
commit
eb633c607e
|
@ -113,13 +113,13 @@ func (fe *FlowExecutor) CheckApplicationAccess(appSlug string) (bool, error) {
|
||||||
acsp := sentry.StartSpan(fe.Context, "authentik.outposts.flow_executor.check_access")
|
acsp := sentry.StartSpan(fe.Context, "authentik.outposts.flow_executor.check_access")
|
||||||
defer acsp.Finish()
|
defer acsp.Finish()
|
||||||
p, _, err := fe.api.CoreApi.CoreApplicationsCheckAccessRetrieve(acsp.Context(), appSlug).Execute()
|
p, _, err := fe.api.CoreApi.CoreApplicationsCheckAccessRetrieve(acsp.Context(), appSlug).Execute()
|
||||||
|
if err != nil {
|
||||||
|
return false, fmt.Errorf("failed to check access: %w", err)
|
||||||
|
}
|
||||||
if !p.Passing {
|
if !p.Passing {
|
||||||
fe.log.Info("Access denied for user")
|
fe.log.Info("Access denied for user")
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return false, fmt.Errorf("failed to check access: %w", err)
|
|
||||||
}
|
|
||||||
fe.log.Debug("User has access")
|
fe.log.Debug("User has access")
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,6 +103,7 @@ func (ms *MemorySearcher) Search(req *search.Request) (ldap.ServerSearchResult,
|
||||||
if flags.CanSearch {
|
if flags.CanSearch {
|
||||||
users = &ms.users
|
users = &ms.users
|
||||||
} else {
|
} else {
|
||||||
|
u := make([]api.User, 1)
|
||||||
if flags.UserInfo == nil {
|
if flags.UserInfo == nil {
|
||||||
for i, u := range ms.users {
|
for i, u := range ms.users {
|
||||||
if u.Pk == flags.UserPk {
|
if u.Pk == flags.UserPk {
|
||||||
|
@ -114,11 +115,9 @@ func (ms *MemorySearcher) Search(req *search.Request) (ldap.ServerSearchResult,
|
||||||
req.Log().WithField("pk", flags.UserPk).Warning("User with pk is not in local cache")
|
req.Log().WithField("pk", flags.UserPk).Warning("User with pk is not in local cache")
|
||||||
err = fmt.Errorf("failed to get userinfo")
|
err = fmt.Errorf("failed to get userinfo")
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
u[0] = *flags.UserInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
u := make([]api.User, 1)
|
|
||||||
u[0] = *flags.UserInfo
|
|
||||||
|
|
||||||
users = &u
|
users = &u
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue