Commit graph

37 commits

Author SHA1 Message Date
Sonja Happ
c33bcd0202 Fix password validation to work with testing DB entries 2019-07-04 15:50:48 +02:00
Sonja Happ
7edb27de2e Merge branch 'user-validators'
# Conflicts:
#	go.mod
#	go.sum
#	routes/user/userEndpoints.go
#	routes/user/userMethods.go
2019-07-04 15:39:41 +02:00
Sonja Happ
9bc9dc6b5d user: add check of for admin role if role of user shall be modified, some small corrections of responses, input forms, and parameter spelling 2019-07-04 11:37:00 +02:00
smavros
c68510fa99 Adds validation of login request:
- Renames type Credentials to loginRequest
2019-06-12 16:04:15 +02:00
smavros
b74b5f3a44 Fixes bug in getUsers(). Adds helper funnction. 2019-06-10 16:47:46 +02:00
smavros
8e2bfe3f47 Changes in getUsers for GET /users endpoint:
- User role can only update a user
2019-06-10 13:59:29 +02:00
Sonja Happ
4806583b1f Merge branch 'authentication'
# Conflicts:
#	common/models.go
#	common/utilities.go
#	routes/user/userEndpoints.go
2019-06-05 10:42:49 +02:00
smavros
1b39f2fd83 Adds global constant strings for Context custom variables 2019-06-05 10:03:12 +02:00
smavros
83444505b0 Implements updateUser() for user endpoint WIP
- Improves user.update() method
2019-06-04 21:56:28 +02:00
smavros
e4c8fb9825 Renames IsActionAllowed() to ValidateRole() 2019-06-04 20:33:27 +02:00
smavros
683ea46b15 Adds role validation in other user endpoints 2019-06-04 20:28:15 +02:00
smavros
5d3bb4c632 Improves actions mechanism in common package
- Typedefs the name of a model (ModelName) and the CRUD operations
    (CRUD).
    - Defines constants for models's names and the 4 CRUD operations
    - Changes the corresponding functions that need to validate the role
2019-06-04 20:22:09 +02:00
smavros
1a1a3c1876 Adds IsActionAllowed() in common utilities
- Is used only in deleteUser handler function for now
2019-06-04 18:03:47 +02:00
Sonja Happ
0d51f00a22 Merge branch 'authentication'
# Conflicts:
#	routes/user/userMethods.go
2019-06-03 13:20:09 +02:00
smavros
60d2ee94a2 Improves JWT claims:
- Turns custom claim's userID type from string to uint
    - Improves userToContext() function for saving the id and role of
    the authenticated user to the context
    - Improves Authentication() middleware function
2019-06-02 22:51:13 +02:00
smavros
f805bf1b33 Handles bindJSON error in addUser endpoint 2019-05-30 13:07:25 +02:00
smavros
c1fcf7e0c0 Improves authenticate endpoint:
- Deals with JSON bind error properly. Returs http code 422 and
    error message
    - Renames the handler function from authenticationEp to authenticate
2019-05-30 13:04:50 +02:00
smavros
73691f9595 Implements DELETE /user/{UserID} endpoint 2019-05-29 23:43:37 +02:00
Sonja Happ
f197a1b823 implementations in simulation endpoints, WIP 2019-05-29 09:43:21 +02:00
Sonja Happ
786e36398b implement model-specific methods instead of queries (WIP) 2019-05-28 16:41:30 +02:00
Sonja Happ
4d9af7b0d3 test 2019-05-28 10:41:59 +02:00
Sonja Happ
f6ea39af12 Merge branch 'master' into authentication
# Conflicts:
#	go.mod
#	go.sum
#	routes/user/userEndpoints.go
#	routes/user/userSerializer.go
#	start.go
2019-05-28 10:40:53 +02:00
Sonja Happ
34eebbab88 Shorten API URLs, add more documentation for swaggo 2019-05-27 14:43:12 +02:00
smavros
2eb37938cb Removes original request from /authenticate response 2019-05-27 09:38:13 +02:00
smavros
8994b9e7a0 Replaces findUserByUsername with User.byUsername() 2019-05-26 19:05:09 +02:00
smavros
150bd76dda Implements userReadEp() for GET /users/:UserID
- Modifies UserSerializer.Response() by adding an argument for
    including or not the model's associations in the respone. If not
    the associations fields are present but their values are null
    - Adds User.byID() method for finding user by the ID which is
    fetched by the resource path of the endpoint
2019-05-26 18:19:05 +02:00
smavros
a6429c53f1 Removes GET /users/me endpoint and handler func 2019-05-26 15:04:16 +02:00
smavros
a20ff0fce6 Adds generation of JWT for authentication 2019-05-26 15:02:15 +02:00
Sonja Happ
144c97ce49 Refactoring code base to new structure, removing circular dependencies, creating response types 2019-05-23 16:50:05 +02:00
smavros
0a559b6c52 Turns user methods to unexported 2019-05-22 15:40:12 +02:00
smavros
8041ab2bc4 Implements user registration endpoint 2019-05-22 15:33:34 +02:00
Sonja Happ
44e15773fd Major changes:
- revise data model to new version (without project)
- adapt database test to new data model
- use separate folder for all endpoint defs and functions to avoid circular deps
- add all API endpoints and skeletons for their implementation
2019-05-21 12:49:39 +02:00
smavros
8216767722 Changes in the user package:
- Moves `POST /users` to the users endpoint group where
    authentication is required
    - Renames userLogin to loginRequest
    - Adds userMethods.go source file to the package user
    - Adds type User in the user package which just wrapps the type
    common.User so methods can be added to the type
    - Adds prototypes of methods for setting/validating password and
    updating type User's data
2019-05-20 12:04:37 +02:00
smavros
ab0d8dea8b Work in progress: /authenticate endpoint handler 2019-05-18 18:54:58 +02:00
smavros
a7f15e79fe First try for Authentication middleware 2019-05-16 15:39:48 +02:00
Sonja Happ
2e7475a26b - add first draft of code for other routes (not complete!)
- some new endpoints
- some new DB queries
- some new serializers
2019-05-09 17:02:24 +02:00
Sonja Happ
83e8563526 use new folder structure for implementation of routes 2019-05-09 11:50:18 +02:00
Renamed from common/userEndpoints.go (Browse further)