tsk-76: Added model and context for AccessLevel (#108)
* tsk-76: Added model and context for AccessLevel * Formatted code * AccessLevel migrations are working * minor formatting * tsk-#76: Saving AccessLevel when uploading song * tsk-#76: Added endpoints * tsk-#76: Warning fix * tsk-#76: Adding more controller code * Functionality to modify access levels is operational * Formatting * tsk-#76: Added functionality * tsk-#76: Formatting code * tsk-#76: Adding more code * tsk-#76: Formatting
This commit was merged in pull request #108.
This commit is contained in:
@@ -86,6 +86,20 @@ public class SongController : BaseController
|
||||
});
|
||||
}
|
||||
|
||||
var tokenManager = new TokenManager(this._config!);
|
||||
var accLvlContext = new AccessLevelContext(this._connectionString!);
|
||||
var accessLevel = accLvlContext.GetAccessLevel(song.Id);
|
||||
var token = tokenManager.GetBearerToken(HttpContext);
|
||||
if (token == null || accessLevel == null)
|
||||
{
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
if (!tokenManager.CanAccessSong(token, song, accessLevel))
|
||||
{
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
var songRes = _songMgr.UpdateSong(song);
|
||||
|
||||
return Ok(songRes);
|
||||
|
||||
Reference in New Issue
Block a user