-
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #46 from michaelcoll/feat/role-based-access
feat(back): Role based access
- Loading branch information
Showing
35 changed files
with
612 additions
and
467 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,22 @@ | ||
-- name: FindUserById :many | ||
SELECT u.*, ur.role_id | ||
FROM user u LEFT JOIN user_role ur ON u.id = ur.user_id | ||
-- name: FindUserById :one | ||
SELECT * | ||
FROM user | ||
WHERE id = ?; | ||
|
||
-- name: CreateOrReplaceUser :exec | ||
REPLACE INTO user (id, email, firstname, lastname) | ||
VALUES (?, ?, ?, ?); | ||
|
||
-- name: FindTokenByTokenStr :one | ||
SELECT t.*, u.email | ||
FROM token t JOIN user u ON u.id = t.user_id | ||
WHERE opaque_token = ?; | ||
|
||
-- name: CreateOrReplaceToken :exec | ||
REPLACE INTO token (opaque_token, user_id, expires, aud) | ||
VALUES (?, ?, ?, ?); | ||
-- name: FindAllUser :many | ||
SELECT * | ||
FROM user; | ||
|
||
-- name: AddRoleToUser :exec | ||
REPLACE INTO user_role (user_id, role_id) | ||
VALUES (?, ?); | ||
-- name: CreateOrReplaceUser :exec | ||
REPLACE INTO user (id, email, firstname, lastname, role_id) | ||
VALUES (?, ?, ?, ?, ?); | ||
|
||
-- name: RemoveAllRoleFromUser :exec | ||
DELETE FROM user_role | ||
WHERE user_id = ? | ||
-- name: UpdateUserRole :exec | ||
UPDATE user | ||
SET role_id = ? | ||
WHERE id = ?; | ||
|
||
-- name: UpdateUserActive :exec | ||
UPDATE user | ||
SET active = ? | ||
WHERE id = ?; |
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
Oops, something went wrong.