diff options
Diffstat (limited to 'backend')
-rw-r--r-- | backend/api/api/Controllers/AuthController.cs | 7 | ||||
-rw-r--r-- | backend/api/api/Controllers/UserController.cs | 2 | ||||
-rw-r--r-- | backend/api/api/Services/UserService.cs | 8 | ||||
-rw-r--r-- | backend/api/api/appsettings.json | 1 |
4 files changed, 11 insertions, 7 deletions
diff --git a/backend/api/api/Controllers/AuthController.cs b/backend/api/api/Controllers/AuthController.cs index 01354f87..e1601815 100644 --- a/backend/api/api/Controllers/AuthController.cs +++ b/backend/api/api/Controllers/AuthController.cs @@ -30,6 +30,13 @@ namespace api.Controllers return Ok(_auth.Login(user)); } + [HttpGet("Auth")] + [Authorize(Roles ="User")] + public async Task<ActionResult<string>> TestAuth() + { + return Ok("works"); + } + } diff --git a/backend/api/api/Controllers/UserController.cs b/backend/api/api/Controllers/UserController.cs index 85f8218d..caf78d9c 100644 --- a/backend/api/api/Controllers/UserController.cs +++ b/backend/api/api/Controllers/UserController.cs @@ -37,6 +37,7 @@ namespace api.Controllers return user; } + // GET api/<UserController>/5 //potrebno za profile page [HttpGet("{id}")] @@ -49,6 +50,7 @@ namespace api.Controllers return user; } + // POST api/<UserController> [HttpPost] public ActionResult<User> Post([FromBody] User user) diff --git a/backend/api/api/Services/UserService.cs b/backend/api/api/Services/UserService.cs index e6f28e92..c626889d 100644 --- a/backend/api/api/Services/UserService.cs +++ b/backend/api/api/Services/UserService.cs @@ -23,6 +23,7 @@ namespace api.Services { return _users.Find(user => true).ToList(); } + public User GetUserUsername(string username) { return _users.Find(user => user.Username == username).FirstOrDefault(); @@ -54,7 +55,6 @@ namespace api.Services "lastName" : "Ljubisavljevic" } - { "_id": { "$oid": "62291140d88e6bcf95c96a58" @@ -62,10 +62,6 @@ namespace api.Services "uploaderId":"", "extension" : "", "name" : "" - - } - - -*/
\ No newline at end of file +*/ diff --git a/backend/api/api/appsettings.json b/backend/api/api/appsettings.json index b9bb665a..3661f171 100644 --- a/backend/api/api/appsettings.json +++ b/backend/api/api/appsettings.json @@ -14,7 +14,6 @@ "ConnectionString": "mongodb://127.0.0.1:27017/", "DatabaseName": "si_project", "CollectionName": "User" - */ "ConnectionString": "mongodb+srv://si_user:si_user@sidatabase.twtfm.mongodb.net/myFirstDatabase?retryWrites=true&w=majority", "DatabaseName": "si_db", |