Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Hot-fix] rename #291

Merged
merged 1 commit into from
Aug 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/server/handler_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

func createNetworkHandler(ctx *web.Context) {
sp, req, resp := ctx.ServiceProvider, ctx.Request, ctx.Response
mgoID, ok := req.Attribute("UserID").(string)
userID, ok := req.Attribute("UserID").(string)
if !ok {
response.Unauthorized(req.Request, resp.ResponseWriter, fmt.Errorf("Unauthorized: User ID is empty"))
return
Expand Down Expand Up @@ -62,7 +62,7 @@ func createNetworkHandler(ctx *web.Context) {

network.ID = bson.NewObjectId()
network.CreatedAt = timeutils.Now()
network.OwnerID = bson.ObjectIdHex(mgoID)
network.OwnerID = bson.ObjectIdHex(userID)
if err := session.Insert(entity.NetworkCollectionName, &network); err != nil {
if mgo.IsDup(err) {
response.Conflict(req.Request, resp, fmt.Errorf("Network Name: %s already existed", network.Name))
Expand Down
4 changes: 2 additions & 2 deletions src/server/handler_pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

func createPodHandler(ctx *web.Context) {
sp, req, resp := ctx.ServiceProvider, ctx.Request, ctx.Response
mgoID, ok := req.Attribute("UserID").(string)
userID, ok := req.Attribute("UserID").(string)
if !ok {
response.Unauthorized(req.Request, resp.ResponseWriter, fmt.Errorf("Unauthorized: User ID is empty"))
return
Expand Down Expand Up @@ -62,7 +62,7 @@ func createPodHandler(ctx *web.Context) {
return
}

p.OwnerID = bson.ObjectIdHex(mgoID)
p.OwnerID = bson.ObjectIdHex(userID)
if err := session.Insert(entity.PodCollectionName, &p); err != nil {
if mgo.IsDup(err) {
response.Conflict(req.Request, resp.ResponseWriter, fmt.Errorf("Pod Name: %s already existed", p.Name))
Expand Down
4 changes: 2 additions & 2 deletions src/server/handler_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

func createServiceHandler(ctx *web.Context) {
sp, req, resp := ctx.ServiceProvider, ctx.Request, ctx.Response
mgoID, ok := req.Attribute("UserID").(string)
userID, ok := req.Attribute("UserID").(string)
if !ok {
response.Unauthorized(req.Request, resp.ResponseWriter, fmt.Errorf("Unauthorized: User ID is empty"))
return
Expand All @@ -48,7 +48,7 @@ func createServiceHandler(ctx *web.Context) {
// Check whether this name has been used
s.ID = bson.NewObjectId()
s.CreatedAt = timeutils.Now()
s.OwnerID = bson.ObjectIdHex(mgoID)
s.OwnerID = bson.ObjectIdHex(userID)
if err := service.CreateService(sp, &s); err != nil {
if errors.IsAlreadyExists(err) {
response.Conflict(req.Request, resp.ResponseWriter, fmt.Errorf("Service Name: %s already existed", s.Name))
Expand Down
4 changes: 2 additions & 2 deletions src/server/handler_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ func signUpUserHandler(ctx *web.Context) {

func verifyTokenHandler(ctx *web.Context) {
_, req, resp := ctx.ServiceProvider, ctx.Request, ctx.Response
mgoID, ok := req.Attribute("UserID").(string)
userID, ok := req.Attribute("UserID").(string)
if !ok {
response.Unauthorized(req.Request, resp.ResponseWriter, fmt.Errorf("Unauthorized: User ID is empty"))
return
}
http.Redirect(resp.ResponseWriter, req.Request, "/v1/users/"+mgoID, 303)
http.Redirect(resp.ResponseWriter, req.Request, "/v1/users/"+userID, 303)
}

func signInUserHandler(ctx *web.Context) {
Expand Down
4 changes: 2 additions & 2 deletions src/server/handler_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

func createVolumeHandler(ctx *web.Context) {
sp, req, resp := ctx.ServiceProvider, ctx.Request, ctx.Response
mgoID, ok := req.Attribute("UserID").(string)
userID, ok := req.Attribute("UserID").(string)
if !ok {
response.Unauthorized(req.Request, resp.ResponseWriter, fmt.Errorf("Unauthorized: User ID is empty"))
return
Expand All @@ -48,7 +48,7 @@ func createVolumeHandler(ctx *web.Context) {
// Check whether this name has been used
v.ID = bson.NewObjectId()
v.CreatedAt = timeutils.Now()
v.OwnerID = bson.ObjectIdHex(mgoID)
v.OwnerID = bson.ObjectIdHex(userID)
// Generate the metaName for PVC meta name and we will use it future
if err := volume.CreateVolume(sp, &v); err != nil {
if errors.IsAlreadyExists(err) {
Expand Down