summaryrefslogtreecommitdiffstats
path: root/src/dcm/api/userPermissionsHandler.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/dcm/api/userPermissionsHandler.go')
-rw-r--r--src/dcm/api/userPermissionsHandler.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/dcm/api/userPermissionsHandler.go b/src/dcm/api/userPermissionsHandler.go
index 156c390f..3ac955fa 100644
--- a/src/dcm/api/userPermissionsHandler.go
+++ b/src/dcm/api/userPermissionsHandler.go
@@ -89,8 +89,12 @@ func (h userPermissionHandler) getHandler(w http.ResponseWriter, r *http.Request
return
}
} else {
- ret, err = h.client.GetAllUserPerms(project, logicalCloud)
+ ret, err = h.client.GetUserPerm(project, logicalCloud, name)
if err != nil {
+ if err.Error() == "User Permission does not exist" {
+ http.Error(w, err.Error(), http.StatusNotFound)
+ return
+ }
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
@@ -131,12 +135,16 @@ func (h userPermissionHandler) updateHandler(w http.ResponseWriter, r *http.Requ
ret, err := h.client.UpdateUserPerm(project, logicalCloud, name, v)
if err != nil {
+ if err.Error() == "User Permission does not exist" {
+ http.Error(w, err.Error(), http.StatusNotFound)
+ return
+ }
http.Error(w, err.Error(),
http.StatusInternalServerError)
return
}
w.Header().Set("Content-Type", "application/json")
- w.WriteHeader(http.StatusCreated)
+ w.WriteHeader(http.StatusOK)
err = json.NewEncoder(w).Encode(ret)
if err != nil {
http.Error(w, err.Error(),