From dc4bebb13eccd1dc19db3bcfaf18955d27e95f3d Mon Sep 17 00:00:00 2001 From: Annika Date: Thu, 4 Aug 2022 16:08:55 -0600 Subject: [PATCH] private vaults now handled properly --- keepr.client/src/components/KeepModal.vue | 4 ++++ keepr.client/src/services/ProfilesService.js | 1 + keepr/Controllers/ProfilesController.cs | 19 +++++++++++++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/keepr.client/src/components/KeepModal.vue b/keepr.client/src/components/KeepModal.vue index 92d1dd9..f9e0220 100644 --- a/keepr.client/src/components/KeepModal.vue +++ b/keepr.client/src/components/KeepModal.vue @@ -89,4 +89,8 @@ export default { font-size: 32px; font-weight: 300; } + + .img-fluid { + max-height: 90vh; + } \ No newline at end of file diff --git a/keepr.client/src/services/ProfilesService.js b/keepr.client/src/services/ProfilesService.js index 719723a..ecaaf85 100644 --- a/keepr.client/src/services/ProfilesService.js +++ b/keepr.client/src/services/ProfilesService.js @@ -25,6 +25,7 @@ class ProfilesService { async getVaults(profileId) { try { const res = await api.get('api/profiles/' + profileId + '/vaults') + logger.log(res.data) AppState.profileVaults = res.data } catch (error) { logger.error(error) diff --git a/keepr/Controllers/ProfilesController.cs b/keepr/Controllers/ProfilesController.cs index 39f72b7..343d2e2 100644 --- a/keepr/Controllers/ProfilesController.cs +++ b/keepr/Controllers/ProfilesController.cs @@ -2,6 +2,9 @@ using System.Collections.Generic; using keepr.Models; using keepr.Services; using Microsoft.AspNetCore.Mvc; +using CodeWorks.Auth0Provider; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; namespace keepr.Controllers { @@ -51,11 +54,23 @@ namespace keepr.Controllers } [HttpGet("{id}/vaults")] - public ActionResult> GetProfileVaults(string id) + public async Task>> GetProfileVaults(string id) { try { - List vaults = _vs.GetProfileVaults(id); + Account userInfo = await HttpContext.GetUserInfoAsync(); + List vaults; + if (userInfo == null || userInfo?.Id != id) + { + // System.Console.WriteLine("didn't auth"); + vaults = _vs.GetProfileVaults(id); + } + else + { + // System.Console.WriteLine("authed"); + vaults = _vs.GetMyVaults(id); + } + return Ok(vaults); } catch (System.Exception e)