mirror of
https://github.com/minio/minio.git
synced 2025-04-22 11:26:36 -04:00
Avoid crashes on peers if IAMSys is not initialized (#8636)
This commit is contained in:
parent
d266b3a066
commit
fa00a84709
@ -172,6 +172,11 @@ func (s *peerRESTServer) DeletePolicyHandler(w http.ResponseWriter, r *http.Requ
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if globalIAMSys == nil {
|
||||||
|
s.writeErrorResponse(w, errServerNotInitialized)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
policyName := vars[peerRESTPolicy]
|
policyName := vars[peerRESTPolicy]
|
||||||
if policyName == "" {
|
if policyName == "" {
|
||||||
@ -200,6 +205,11 @@ func (s *peerRESTServer) LoadPolicyHandler(w http.ResponseWriter, r *http.Reques
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if globalIAMSys == nil {
|
||||||
|
s.writeErrorResponse(w, errServerNotInitialized)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
policyName := vars[peerRESTPolicy]
|
policyName := vars[peerRESTPolicy]
|
||||||
if policyName == "" {
|
if policyName == "" {
|
||||||
@ -228,6 +238,11 @@ func (s *peerRESTServer) LoadPolicyMappingHandler(w http.ResponseWriter, r *http
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if globalIAMSys == nil {
|
||||||
|
s.writeErrorResponse(w, errServerNotInitialized)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
userOrGroup := vars[peerRESTUserOrGroup]
|
userOrGroup := vars[peerRESTUserOrGroup]
|
||||||
if userOrGroup == "" {
|
if userOrGroup == "" {
|
||||||
@ -257,6 +272,11 @@ func (s *peerRESTServer) DeleteUserHandler(w http.ResponseWriter, r *http.Reques
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if globalIAMSys == nil {
|
||||||
|
s.writeErrorResponse(w, errServerNotInitialized)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
accessKey := vars[peerRESTUser]
|
accessKey := vars[peerRESTUser]
|
||||||
if accessKey == "" {
|
if accessKey == "" {
|
||||||
@ -285,6 +305,11 @@ func (s *peerRESTServer) LoadUserHandler(w http.ResponseWriter, r *http.Request)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if globalIAMSys == nil {
|
||||||
|
s.writeErrorResponse(w, errServerNotInitialized)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
accessKey := vars[peerRESTUser]
|
accessKey := vars[peerRESTUser]
|
||||||
if accessKey == "" {
|
if accessKey == "" {
|
||||||
@ -313,6 +338,17 @@ func (s *peerRESTServer) LoadUsersHandler(w http.ResponseWriter, r *http.Request
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
objAPI := newObjectLayerWithoutSafeModeFn()
|
||||||
|
if objAPI == nil {
|
||||||
|
s.writeErrorResponse(w, errServerNotInitialized)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if globalIAMSys == nil {
|
||||||
|
s.writeErrorResponse(w, errServerNotInitialized)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
err := globalIAMSys.Load()
|
err := globalIAMSys.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.writeErrorResponse(w, err)
|
s.writeErrorResponse(w, err)
|
||||||
@ -335,6 +371,11 @@ func (s *peerRESTServer) LoadGroupHandler(w http.ResponseWriter, r *http.Request
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if globalIAMSys == nil {
|
||||||
|
s.writeErrorResponse(w, errServerNotInitialized)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
group := vars[peerRESTGroup]
|
group := vars[peerRESTGroup]
|
||||||
err := globalIAMSys.LoadGroup(objAPI, group)
|
err := globalIAMSys.LoadGroup(objAPI, group)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user