Skip to content

Commit

Permalink
return proper errors when ocs/cloud/users is using the cs3 backend
Browse files Browse the repository at this point in the history
The ocs API was just exiting with a fatal error on any update request,
when configured for the cs3 backend. Now it returns a proper error.

Closes: owncloud#3483
  • Loading branch information
rhafer committed Apr 20, 2022
1 parent cf49097 commit fe53043
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/ocs-cs3-fatal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: return proper errors when ocs/cloud/users is using the cs3 backend

The ocs API was just exiting with a fatal error on any update request,
when configured for the cs3 backend. Now it returns a proper error.

https://github.com/owncloud/ocis/issues/3483
24 changes: 18 additions & 6 deletions extensions/ocs/pkg/service/v0/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,9 @@ func (o Ocs) AddUser(w http.ResponseWriter, r *http.Request) {
Account: newAccount,
})
case "cs3":
o.logger.Fatal().Msg("cs3 backend doesn't support adding users")
o.logger.Warn().Msg("cs3 backend doesn't support adding users")
o.NotImplementedStub(w, r)
return
default:
o.logger.Fatal().Msgf("Invalid accounts backend type '%s'", o.config.AccountBackend)
}
Expand Down Expand Up @@ -293,7 +295,9 @@ func (o Ocs) EditUser(w http.ResponseWriter, r *http.Request) {
case "accounts":
account, err = o.fetchAccountByUsername(r.Context(), userid)
case "cs3":
o.logger.Fatal().Msg("cs3 backend doesn't support editing users")
o.logger.Warn().Msg("cs3 backend doesn't support adding users")
o.NotImplementedStub(w, r)
return
default:
o.logger.Fatal().Msgf("Invalid accounts backend type '%s'", o.config.AccountBackend)
}
Expand Down Expand Up @@ -374,7 +378,9 @@ func (o Ocs) DeleteUser(w http.ResponseWriter, r *http.Request) {
case "accounts":
account, err = o.fetchAccountByUsername(r.Context(), userid)
case "cs3":
o.logger.Fatal().Msg("cs3 backend doesn't support deleting users")
o.logger.Warn().Msg("cs3 backend doesn't support adding users")
o.NotImplementedStub(w, r)
return
default:
o.logger.Fatal().Msgf("Invalid accounts backend type '%s'", o.config.AccountBackend)
}
Expand Down Expand Up @@ -546,7 +552,9 @@ func (o Ocs) EnableUser(w http.ResponseWriter, r *http.Request) {
case "accounts":
account, err = o.fetchAccountByUsername(r.Context(), userid)
case "cs3":
o.logger.Fatal().Msg("cs3 backend doesn't support enabling users")
o.logger.Warn().Msg("cs3 backend doesn't support adding users")
o.NotImplementedStub(w, r)
return
default:
o.logger.Fatal().Msgf("Invalid accounts backend type '%s'", o.config.AccountBackend)
}
Expand Down Expand Up @@ -600,7 +608,9 @@ func (o Ocs) DisableUser(w http.ResponseWriter, r *http.Request) {
case "accounts":
account, err = o.fetchAccountByUsername(r.Context(), userid)
case "cs3":
o.logger.Fatal().Msg("cs3 backend doesn't support disabling users")
o.logger.Warn().Msg("cs3 backend doesn't support adding users")
o.NotImplementedStub(w, r)
return
default:
o.logger.Fatal().Msgf("Invalid accounts backend type '%s'", o.config.AccountBackend)
}
Expand Down Expand Up @@ -730,7 +740,9 @@ func (o Ocs) ListUsers(w http.ResponseWriter, r *http.Request) {
})
case "cs3":
// TODO
o.logger.Fatal().Msg("cs3 backend doesn't support listing users")
o.logger.Warn().Msg("cs3 backend doesn't support adding users")
o.NotImplementedStub(w, r)
return
default:
o.logger.Fatal().Msgf("Invalid accounts backend type '%s'", o.config.AccountBackend)
}
Expand Down

0 comments on commit fe53043

Please sign in to comment.