-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from Michael2008S/master
change user's RoleID to AccessRole type
- Loading branch information
Showing
15 changed files
with
52 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,7 @@ func TestCreate(t *testing.T) { | |
name: "Fail on userSvc", | ||
req: `{"first_name":"John","last_name":"Doe","username":"juzernejm","password":"hunter123","password_confirm":"hunter123","email":"[email protected]","company_id":1,"location_id":2,"role_id":2}`, | ||
rbac: &mock.RBAC{ | ||
AccountCreateFn: func(c echo.Context, roleID, companyID, locationID int) error { | ||
AccountCreateFn: func(c echo.Context, roleID model.AccessRole, companyID, locationID int) error { | ||
return echo.ErrForbidden | ||
}, | ||
}, | ||
|
@@ -50,7 +50,7 @@ func TestCreate(t *testing.T) { | |
name: "Success", | ||
req: `{"first_name":"John","last_name":"Doe","username":"juzernejm","password":"hunter123","password_confirm":"hunter123","email":"[email protected]","company_id":1,"location_id":2,"role_id":2}`, | ||
rbac: &mock.RBAC{ | ||
AccountCreateFn: func(c echo.Context, roleID, companyID, locationID int) error { | ||
AccountCreateFn: func(c echo.Context, roleID model.AccessRole, companyID, locationID int) error { | ||
return nil | ||
}, | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ package main | |
|
||
import ( | ||
"fmt" | ||
"github.com/ribice/gorsk/internal/auth" | ||
"log" | ||
"strings" | ||
|
||
|
@@ -10,7 +11,6 @@ import ( | |
"github.com/ribice/gorsk/internal" | ||
|
||
"github.com/go-pg/pg" | ||
"github.com/ribice/gorsk/internal/auth" | ||
) | ||
|
||
func main() { | ||
|
@@ -35,7 +35,7 @@ func main() { | |
_, err := db.Exec(v) | ||
checkErr(err) | ||
} | ||
userInsert := `INSERT INTO public.users VALUES (1, now(),now(), NULL, 'Admin', 'Admin', 'admin', '%s', '[email protected]', NULL, NULL, NULL, NULL, true, 1, 1, 1);` | ||
userInsert := `INSERT INTO public.users VALUES (1, now(),now(), NULL, 'Admin', 'Admin', 'admin', '%s', '[email protected]', NULL, NULL, NULL, NULL, true, NULL, 1, 1, 1);` | ||
_, err = db.Exec(fmt.Sprintf(userInsert, auth.HashPassword("admin"))) | ||
checkErr(err) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -222,7 +222,7 @@ func TestRefresh(t *testing.T) { | |
func TestUser(t *testing.T) { | ||
ctx := mock.EchoCtxWithKeys([]string{ | ||
"id", "company_id", "location_id", "username", "email", "role"}, | ||
9, 15, 52, "ribice", "[email protected]", int8(1)) | ||
9, 15, 52, "ribice", "[email protected]", model.AccessRole(1)) | ||
wantUser := &model.AuthUser{ | ||
ID: 9, | ||
Username: "ribice", | ||
|
@@ -262,7 +262,7 @@ func TestMe(t *testing.T) { | |
name: "Success", | ||
ctx: mock.EchoCtxWithKeys([]string{ | ||
"id", "company_id", "location_id", "username", "email", "role"}, | ||
9, 15, 52, "ribice", "[email protected]", int8(1)), | ||
9, 15, 52, "ribice", "[email protected]", model.AccessRole(1)), | ||
udb: &mockdb.User{ | ||
ViewFn: func(db orm.DB, id int) (*model.User, error) { | ||
return &model.User{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters