Commit b671b970 by Torkel Ödegaard

changed property name to UserWasDeleted and added an assert for it

parent 9585dc78
...@@ -103,8 +103,8 @@ func updateOrgUserHelper(cmd m.UpdateOrgUserCommand) Response { ...@@ -103,8 +103,8 @@ func updateOrgUserHelper(cmd m.UpdateOrgUserCommand) Response {
// DELETE /api/org/users/:userId // DELETE /api/org/users/:userId
func RemoveOrgUserForCurrentOrg(c *m.ReqContext) Response { func RemoveOrgUserForCurrentOrg(c *m.ReqContext) Response {
return removeOrgUserHelper(&m.RemoveOrgUserCommand{ return removeOrgUserHelper(&m.RemoveOrgUserCommand{
UserId: c.ParamsInt64(":userId"), UserId: c.ParamsInt64(":userId"),
OrgId: c.OrgId, OrgId: c.OrgId,
ShouldDeleteOrphanedUser: true, ShouldDeleteOrphanedUser: true,
}) })
} }
...@@ -125,7 +125,7 @@ func removeOrgUserHelper(cmd *m.RemoveOrgUserCommand) Response { ...@@ -125,7 +125,7 @@ func removeOrgUserHelper(cmd *m.RemoveOrgUserCommand) Response {
return Error(500, "Failed to remove user from organization", err) return Error(500, "Failed to remove user from organization", err)
} }
if cmd.UserWasRemoved { if cmd.UserWasDeleted {
return Success("User deleted") return Success("User deleted")
} }
......
...@@ -75,7 +75,7 @@ type RemoveOrgUserCommand struct { ...@@ -75,7 +75,7 @@ type RemoveOrgUserCommand struct {
UserId int64 UserId int64
OrgId int64 OrgId int64
ShouldDeleteOrphanedUser bool ShouldDeleteOrphanedUser bool
UserWasRemoved bool UserWasDeleted bool
} }
type AddOrgUserCommand struct { type AddOrgUserCommand struct {
......
...@@ -191,6 +191,7 @@ func TestAccountDataAccess(t *testing.T) { ...@@ -191,6 +191,7 @@ func TestAccountDataAccess(t *testing.T) {
remCmd := m.RemoveOrgUserCommand{OrgId: ac1.OrgId, UserId: ac2.Id, ShouldDeleteOrphanedUser: true} remCmd := m.RemoveOrgUserCommand{OrgId: ac1.OrgId, UserId: ac2.Id, ShouldDeleteOrphanedUser: true}
err = RemoveOrgUser(&remCmd) err = RemoveOrgUser(&remCmd)
So(err, ShouldBeNil) So(err, ShouldBeNil)
So(remCmd.UserWasDeleted, ShouldBeTrue)
err = GetSignedInUser(&m.GetSignedInUserQuery{UserId: ac2.Id}) err = GetSignedInUser(&m.GetSignedInUserQuery{UserId: ac2.Id})
So(err, ShouldEqual, m.ErrUserNotFound) So(err, ShouldEqual, m.ErrUserNotFound)
......
...@@ -195,7 +195,7 @@ func RemoveOrgUser(cmd *m.RemoveOrgUserCommand) error { ...@@ -195,7 +195,7 @@ func RemoveOrgUser(cmd *m.RemoveOrgUserCommand) error {
return err return err
} }
cmd.UserWasRemoved = true cmd.UserWasDeleted = true
} }
return nil return nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment