From 44394256259f3df06b1d7842842abeda1df3d66e Mon Sep 17 00:00:00 2001 From: MaksimChegulov Date: Fri, 1 Sep 2023 16:00:56 +0300 Subject: [PATCH] fix Bug 63942 --- .../VirtualRooms/InvitationLinkService.cs | 11 - products/ASC.Files/Core/Utils/FileSharing.cs | 7 +- .../ASC.People/Server/Api/UserController.cs | 17 +- web/ASC.Web.Api/Api/PortalController.cs | 501 +++++++++--------- 4 files changed, 268 insertions(+), 268 deletions(-) diff --git a/products/ASC.Files/Core/Core/VirtualRooms/InvitationLinkService.cs b/products/ASC.Files/Core/Core/VirtualRooms/InvitationLinkService.cs index 2ffcb707a1..a89eb1ebc0 100644 --- a/products/ASC.Files/Core/Core/VirtualRooms/InvitationLinkService.cs +++ b/products/ASC.Files/Core/Core/VirtualRooms/InvitationLinkService.cs @@ -108,23 +108,12 @@ public class InvitationLinkService { return new InvitationLinkData { Result = EmailValidationKeyProvider.ValidationResult.Invalid }; } - - if (userId != default) - { - var account = _authManager.GetAccountByID(tenant.Id, userId); - - if (!_permissionContext.CheckPermissions(account, new UserSecurityProvider(employeeType), Constants.Action_AddRemoveUser)) - { - return linkData; - } - } var validationResult = await _invitationLinkHelper.ValidateAsync(key, email, employeeType); linkData.Result = validationResult.Result; linkData.LinkType = validationResult.LinkType; linkData.EmployeeType = employeeType; - if (validationResult.LinkId == default) { if (!await CheckQuota(linkData.LinkType, employeeType)) diff --git a/products/ASC.Files/Core/Utils/FileSharing.cs b/products/ASC.Files/Core/Utils/FileSharing.cs index 374402a2b0..579a409da1 100644 --- a/products/ASC.Files/Core/Utils/FileSharing.cs +++ b/products/ASC.Files/Core/Utils/FileSharing.cs @@ -545,6 +545,11 @@ public class FileSharing if (isRoom && r.IsLink) { + if (!canEditAccess) + { + continue; + } + w.Link = _invitationLinkService.GetInvitationLink(r.Subject, _authContext.CurrentAccount.ID); w.SubjectGroup = true; w.CanEditAccess = false; @@ -561,7 +566,7 @@ public class FileSharing result.Add(w); } - if (isRoom) + if (isRoom && canEditAccess) { var id = Guid.NewGuid(); diff --git a/products/ASC.People/Server/Api/UserController.cs b/products/ASC.People/Server/Api/UserController.cs index 9a79bfcd6b..ddc0637b2c 100644 --- a/products/ASC.People/Server/Api/UserController.cs +++ b/products/ASC.People/Server/Api/UserController.cs @@ -352,9 +352,12 @@ public class UserController : PeopleControllerBase [HttpPost("invite")] public async Task> InviteUsersAsync(InviteUsersRequestDto inDto) { + var currentUser = _userManager.GetUsers(_authContext.CurrentAccount.ID); + foreach (var invite in inDto.Invitations) { - if (!_permissionContext.CheckPermissions(new UserSecurityProvider(Guid.Empty, invite.Type), Constants.Action_AddRemoveUser)) + if ((invite.Type == EmployeeType.DocSpaceAdmin && !currentUser.IsOwner(_tenantManager.GetCurrentTenant())) || + !_permissionContext.CheckPermissions(new UserSecurityProvider(Guid.Empty, invite.Type), Constants.Action_AddRemoveUser)) { continue; } @@ -1149,16 +1152,16 @@ public class UserController : PeopleControllerBase [HttpPost("password")] public object SendUserPassword(MemberRequestDto inDto) { - if (_authContext.IsAuthenticated) + if (_authContext.IsAuthenticated) { - var currentUser = _userManager.GetUserByEmail(inDto.Email); + var currentUser = _userManager.GetUserByEmail(inDto.Email); if (currentUser.Id != _authContext.CurrentAccount.ID && !_userManager.IsDocSpaceAdmin(_authContext.CurrentAccount.ID)) { throw new Exception(Resource.ErrorAccessDenied); - } - } - - var error = _userManagerWrapper.SendUserPassword(inDto.Email); + } + } + + var error = _userManagerWrapper.SendUserPassword(inDto.Email); if (!string.IsNullOrEmpty(error)) { _logger.ErrorPasswordRecovery(inDto.Email, error); diff --git a/web/ASC.Web.Api/Api/PortalController.cs b/web/ASC.Web.Api/Api/PortalController.cs index acb95f8355..d60e01a410 100644 --- a/web/ASC.Web.Api/Api/PortalController.cs +++ b/web/ASC.Web.Api/Api/PortalController.cs @@ -1,59 +1,59 @@ -// (c) Copyright Ascensio System SIA 2010-2022 -// -// This program is a free software product. -// You can redistribute it and/or modify it under the terms -// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software -// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended -// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of -// any third-party rights. -// -// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see -// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html -// -// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021. -// -// The interactive user interfaces in modified source and object code versions of the Program must -// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3. -// -// Pursuant to Section 7(b) of the License you must retain the original Product logo when -// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under -// trademark law for use of our trademarks. -// -// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing -// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 -// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode +// (c) Copyright Ascensio System SIA 2010-2022 +// +// This program is a free software product. +// You can redistribute it and/or modify it under the terms +// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software +// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended +// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of +// any third-party rights. +// +// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see +// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html +// +// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021. +// +// The interactive user interfaces in modified source and object code versions of the Program must +// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3. +// +// Pursuant to Section 7(b) of the License you must retain the original Product logo when +// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under +// trademark law for use of our trademarks. +// +// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing +// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 +// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + +namespace ASC.Web.Api.Controllers; -namespace ASC.Web.Api.Controllers; - /// /// Portal information access. /// ///portal -[Scope] -[DefaultRoute] -[ApiController] -public class PortalController : ControllerBase -{ - protected Tenant Tenant { get { return _apiContext.Tenant; } } - - private readonly ApiContext _apiContext; - protected readonly UserManager _userManager; - protected readonly TenantManager _tenantManager; - protected readonly ITariffService _tariffService; - private readonly CommonLinkUtility _commonLinkUtility; - private readonly UrlShortener _urlShortener; - private readonly AuthContext _authContext; - protected readonly SecurityContext _securityContext; - private readonly SettingsManager _settingsManager; - private readonly IMobileAppInstallRegistrator _mobileAppInstallRegistrator; - private readonly IConfiguration _configuration; - private readonly CoreBaseSettings _coreBaseSettings; - private readonly LicenseReader _licenseReader; - private readonly SetupInfo _setupInfo; - private readonly DocumentServiceLicense _documentServiceLicense; - private readonly TenantExtra _tenantExtra; - private readonly ILogger _log; +[Scope] +[DefaultRoute] +[ApiController] +public class PortalController : ControllerBase +{ + protected Tenant Tenant { get { return _apiContext.Tenant; } } + + private readonly ApiContext _apiContext; + protected readonly UserManager _userManager; + protected readonly TenantManager _tenantManager; + protected readonly ITariffService _tariffService; + private readonly CommonLinkUtility _commonLinkUtility; + private readonly UrlShortener _urlShortener; + private readonly AuthContext _authContext; + protected readonly SecurityContext _securityContext; + private readonly SettingsManager _settingsManager; + private readonly IMobileAppInstallRegistrator _mobileAppInstallRegistrator; + private readonly IConfiguration _configuration; + private readonly CoreBaseSettings _coreBaseSettings; + private readonly LicenseReader _licenseReader; + private readonly SetupInfo _setupInfo; + private readonly DocumentServiceLicense _documentServiceLicense; + private readonly TenantExtra _tenantExtra; + private readonly ILogger _log; private readonly IHttpClientFactory _clientFactory; private readonly ApiSystemHelper _apiSystemHelper; private readonly CoreSettings _coreSettings; @@ -70,24 +70,24 @@ public class PortalController : ControllerBase private readonly QuotaHelper _quotaHelper; private readonly CspSettingsHelper _cspSettingsHelper; - public PortalController( - ILogger logger, - ApiContext apiContext, - UserManager userManager, - TenantManager tenantManager, - ITariffService tariffService, - CommonLinkUtility commonLinkUtility, - UrlShortener urlShortener, - AuthContext authContext, - SecurityContext securityContext, - SettingsManager settingsManager, - IMobileAppInstallRegistrator mobileAppInstallRegistrator, - TenantExtra tenantExtra, - IConfiguration configuration, - CoreBaseSettings coreBaseSettings, - LicenseReader licenseReader, - SetupInfo setupInfo, - DocumentServiceLicense documentServiceLicense, + public PortalController( + ILogger logger, + ApiContext apiContext, + UserManager userManager, + TenantManager tenantManager, + ITariffService tariffService, + CommonLinkUtility commonLinkUtility, + UrlShortener urlShortener, + AuthContext authContext, + SecurityContext securityContext, + SettingsManager settingsManager, + IMobileAppInstallRegistrator mobileAppInstallRegistrator, + TenantExtra tenantExtra, + IConfiguration configuration, + CoreBaseSettings coreBaseSettings, + LicenseReader licenseReader, + SetupInfo setupInfo, + DocumentServiceLicense documentServiceLicense, IHttpClientFactory clientFactory, ApiSystemHelper apiSystemHelper, CoreSettings coreSettings, @@ -102,25 +102,25 @@ public class PortalController : ControllerBase IMapper mapper, IHttpContextAccessor httpContextAccessor, QuotaHelper quotaHelper, - CspSettingsHelper cspSettingsHelper) - { - _log = logger; - _apiContext = apiContext; - _userManager = userManager; - _tenantManager = tenantManager; - _tariffService = tariffService; - _commonLinkUtility = commonLinkUtility; - _urlShortener = urlShortener; - _authContext = authContext; - _securityContext = securityContext; - _settingsManager = settingsManager; - _mobileAppInstallRegistrator = mobileAppInstallRegistrator; - _configuration = configuration; - _coreBaseSettings = coreBaseSettings; - _licenseReader = licenseReader; - _setupInfo = setupInfo; - _documentServiceLicense = documentServiceLicense; - _tenantExtra = tenantExtra; + CspSettingsHelper cspSettingsHelper) + { + _log = logger; + _apiContext = apiContext; + _userManager = userManager; + _tenantManager = tenantManager; + _tariffService = tariffService; + _commonLinkUtility = commonLinkUtility; + _urlShortener = urlShortener; + _authContext = authContext; + _securityContext = securityContext; + _settingsManager = settingsManager; + _mobileAppInstallRegistrator = mobileAppInstallRegistrator; + _configuration = configuration; + _coreBaseSettings = coreBaseSettings; + _licenseReader = licenseReader; + _setupInfo = setupInfo; + _documentServiceLicense = documentServiceLicense; + _tenantExtra = tenantExtra; _clientFactory = clientFactory; _apiSystemHelper = apiSystemHelper; _coreSettings = coreSettings; @@ -136,7 +136,7 @@ public class PortalController : ControllerBase _httpContextAccessor = httpContextAccessor; _quotaHelper = quotaHelper; _cspSettingsHelper = cspSettingsHelper; - } + } /// /// Returns the current portal. @@ -148,13 +148,13 @@ public class PortalController : ControllerBase /// Current portal information /// api/2.0/portal /// GET - [AllowNotPayment] - [HttpGet("")] - public TenantDto Get() - { - return _mapper.Map(Tenant); - } - + [AllowNotPayment] + [HttpGet("")] + public TenantDto Get() + { + return _mapper.Map(Tenant); + } + /// /// Returns a user with the ID specified in the request from the current portal. /// @@ -166,12 +166,12 @@ public class PortalController : ControllerBase /// User information /// api/2.0/portal/users/{userID} /// GET - [HttpGet("users/{userID}")] - public UserInfo GetUser(Guid userID) - { - return _userManager.GetUsers(userID); - } - + [HttpGet("users/{userID}")] + public UserInfo GetUser(Guid userID) + { + return _userManager.GetUsers(userID); + } + /// /// Returns an invitation link for joining the portal. /// @@ -183,18 +183,21 @@ public class PortalController : ControllerBase /// Invitation link /// api/2.0/portal/users/invite/{employeeType} /// GET - [HttpGet("users/invite/{employeeType}")] - public object GeInviteLink(EmployeeType employeeType) - { - if (!_permissionContext.CheckPermissions(new UserSecurityProvider(Guid.Empty, employeeType), ASC.Core.Users.Constants.Action_AddRemoveUser)) + [HttpGet("users/invite/{employeeType}")] + public object GeInviteLink(EmployeeType employeeType) + { + var currentUser = _userManager.GetUsers(_authContext.CurrentAccount.ID); + + if ((employeeType == EmployeeType.DocSpaceAdmin && !currentUser.IsOwner(_tenantManager.GetCurrentTenant())) + || !_permissionContext.CheckPermissions(new UserSecurityProvider(Guid.Empty, employeeType), ASC.Core.Users.Constants.Action_AddRemoveUser)) { return string.Empty; - } - - return _commonLinkUtility.GetConfirmationEmailUrl(string.Empty, ConfirmType.LinkInvite, (int)employeeType, _authContext.CurrentAccount.ID) - + $"&emplType={employeeType:d}"; - } - + } + + return _commonLinkUtility.GetConfirmationEmailUrl(string.Empty, ConfirmType.LinkInvite, (int)employeeType, _authContext.CurrentAccount.ID) + + $"&emplType={employeeType:d}"; + } + /// /// Returns a link specified in the request in the shortened format. /// @@ -204,19 +207,19 @@ public class PortalController : ControllerBase /// Shortened link /// api/2.0/portal/getshortenlink /// PUT - [HttpPut("getshortenlink")] - public async Task GetShortenLinkAsync(ShortenLinkRequestsDto inDto) - { - try - { - return await _urlShortener.Instance.GetShortenLinkAsync(inDto.Link); - } - catch (Exception ex) - { - _log.ErrorGetShortenLink(ex); - return inDto.Link; - } - } + [HttpPut("getshortenlink")] + public async Task GetShortenLinkAsync(ShortenLinkRequestsDto inDto) + { + try + { + return await _urlShortener.Instance.GetShortenLinkAsync(inDto.Link); + } + catch (Exception ex) + { + _log.ErrorGetShortenLink(ex); + return inDto.Link; + } + } /// /// Returns an extra tenant license for the portal. @@ -229,37 +232,37 @@ public class PortalController : ControllerBase /// Extra tenant license information /// api/2.0/portal/tenantextra /// GET - [AllowNotPayment, AllowAnonymous] - [HttpGet("tenantextra")] - public async Task GetTenantExtra(bool refresh) + [AllowNotPayment, AllowAnonymous] + [HttpGet("tenantextra")] + public async Task GetTenantExtra(bool refresh) { var result = new TenantExtraDto { - CustomMode = _coreBaseSettings.CustomMode, - Opensource = _tenantExtra.Opensource, + CustomMode = _coreBaseSettings.CustomMode, + Opensource = _tenantExtra.Opensource, Enterprise = _tenantExtra.Enterprise, - EnableTariffPage = //TenantExtra.EnableTarrifSettings - think about hide-settings for opensource - (!_coreBaseSettings.Standalone || !string.IsNullOrEmpty(_licenseReader.LicensePath)) - && string.IsNullOrEmpty(_setupInfo.AmiMetaUrl) + EnableTariffPage = //TenantExtra.EnableTarrifSettings - think about hide-settings for opensource + (!_coreBaseSettings.Standalone || !string.IsNullOrEmpty(_licenseReader.LicensePath)) + && string.IsNullOrEmpty(_setupInfo.AmiMetaUrl) && !_coreBaseSettings.CustomMode }; - if (_authContext.IsAuthenticated) + if (_authContext.IsAuthenticated) { - result.Tariff = _tenantExtra.GetCurrentTariff(refresh); - result.Quota = await _quotaHelper.GetCurrentQuota(refresh); - result.NotPaid = _tenantExtra.IsNotPaid(); - result.LicenseAccept = _settingsManager.LoadForDefaultTenant().LicenseAcceptSetting; - result.DocServerUserQuota = await _documentServiceLicense.GetLicenseQuotaAsync(); + result.Tariff = _tenantExtra.GetCurrentTariff(refresh); + result.Quota = await _quotaHelper.GetCurrentQuota(refresh); + result.NotPaid = _tenantExtra.IsNotPaid(); + result.LicenseAccept = _settingsManager.LoadForDefaultTenant().LicenseAcceptSetting; + result.DocServerUserQuota = await _documentServiceLicense.GetLicenseQuotaAsync(); result.DocServerLicense = await _documentServiceLicense.GetLicenseAsync(); } - return result; - } - - + return result; + } + + /// /// Returns the used space of the current portal. /// @@ -270,16 +273,16 @@ public class PortalController : ControllerBase /// Used portal space /// api/2.0/portal/usedspace /// GET - [HttpGet("usedspace")] - public double GetUsedSpace() - { - return Math.Round( - _tenantManager.FindTenantQuotaRows(Tenant.Id) - .Where(q => !string.IsNullOrEmpty(q.Tag) && new Guid(q.Tag) != Guid.Empty) - .Sum(q => q.Counter) / 1024f / 1024f / 1024f, 2); - } - - + [HttpGet("usedspace")] + public double GetUsedSpace() + { + return Math.Round( + _tenantManager.FindTenantQuotaRows(Tenant.Id) + .Where(q => !string.IsNullOrEmpty(q.Tag) && new Guid(q.Tag) != Guid.Empty) + .Sum(q => q.Counter) / 1024f / 1024f / 1024f, 2); + } + + /// /// Returns a number of portal users. /// @@ -290,12 +293,12 @@ public class PortalController : ControllerBase /// Number of portal users /// api/2.0/portal/userscount /// GET - [HttpGet("userscount")] - public long GetUsersCount() - { - return _coreBaseSettings.Personal ? 1 : _userManager.GetUserNames(EmployeeStatus.Active).Length; + [HttpGet("userscount")] + public long GetUsersCount() + { + return _coreBaseSettings.Personal ? 1 : _userManager.GetUserNames(EmployeeStatus.Active).Length; } - + /// /// Returns the current portal tariff. /// @@ -307,12 +310,12 @@ public class PortalController : ControllerBase /// Current portal tariff /// api/2.0/portal/tariff /// GET - [AllowNotPayment] - [HttpGet("tariff")] - public Tariff GetTariff(bool refresh) - { - return _tariffService.GetTariff(Tenant.Id, refresh: refresh); - } + [AllowNotPayment] + [HttpGet("tariff")] + public Tariff GetTariff(bool refresh) + { + return _tariffService.GetTariff(Tenant.Id, refresh: refresh); + } /// /// Returns the current portal quota. @@ -324,13 +327,13 @@ public class PortalController : ControllerBase /// Current portal quota /// api/2.0/portal/quota /// GET - [AllowNotPayment] - [HttpGet("quota")] - public TenantQuota GetQuota() - { - return _tenantManager.GetTenantQuota(Tenant.Id); - } - + [AllowNotPayment] + [HttpGet("quota")] + public TenantQuota GetQuota() + { + return _tenantManager.GetTenantQuota(Tenant.Id); + } + /// /// Returns the recommended quota for the current portal. /// @@ -341,19 +344,19 @@ public class PortalController : ControllerBase /// Recommended portal quota /// api/2.0/portal/quota/right /// GET - [HttpGet("quota/right")] - public TenantQuota GetRightQuota() - { - var usedSpace = GetUsedSpace(); - var needUsersCount = GetUsersCount(); - - return _tenantManager.GetTenantQuotas().OrderBy(r => r.Price) - .FirstOrDefault(quota => - quota.CountUser > needUsersCount - && quota.MaxTotalSize > usedSpace); - } - - + [HttpGet("quota/right")] + public TenantQuota GetRightQuota() + { + var usedSpace = GetUsedSpace(); + var needUsersCount = GetUsersCount(); + + return _tenantManager.GetTenantQuotas().OrderBy(r => r.Price) + .FirstOrDefault(quota => + quota.CountUser > needUsersCount + && quota.MaxTotalSize > usedSpace); + } + + /// /// Returns the full absolute path to the current portal. /// @@ -365,12 +368,12 @@ public class PortalController : ControllerBase /// Portal path /// api/2.0/portal/path /// GET - [HttpGet("path")] - public object GetFullAbsolutePath(string virtualPath) - { - return _commonLinkUtility.GetFullAbsolutePath(virtualPath); - } - + [HttpGet("path")] + public object GetFullAbsolutePath(string virtualPath) + { + return _commonLinkUtility.GetFullAbsolutePath(virtualPath); + } + /// /// Returns a thumbnail of the bookmark URL specified in the request. /// @@ -382,40 +385,40 @@ public class PortalController : ControllerBase /// Thumbnail /// api/2.0/portal/thumb /// GET - [HttpGet("thumb")] - public FileResult GetThumb(string url) - { - if (!_securityContext.IsAuthenticated || _configuration["bookmarking:thumbnail-url"] == null) - { - return null; - } - - url = url.Replace("&", "&"); - url = WebUtility.UrlEncode(url); - + [HttpGet("thumb")] + public FileResult GetThumb(string url) + { + if (!_securityContext.IsAuthenticated || _configuration["bookmarking:thumbnail-url"] == null) + { + return null; + } + + url = url.Replace("&", "&"); + url = WebUtility.UrlEncode(url); + var request = new HttpRequestMessage { RequestUri = new Uri(string.Format(_configuration["bookmarking:thumbnail-url"], url)) - }; - - var httpClient = _clientFactory.CreateClient(); - using var response = httpClient.Send(request); - using var stream = response.Content.ReadAsStream(); - var bytes = new byte[stream.Length]; - stream.Read(bytes, 0, (int)stream.Length); - - string type; - if (response.Headers.TryGetValues("Content-Type", out var values)) - { - type = values.First(); - } - else - { - type = "image/png"; - } - return File(bytes, type); - } - + }; + + var httpClient = _clientFactory.CreateClient(); + using var response = httpClient.Send(request); + using var stream = response.Content.ReadAsStream(); + var bytes = new byte[stream.Length]; + stream.Read(bytes, 0, (int)stream.Length); + + string type; + if (response.Headers.TryGetValues("Content-Type", out var values)) + { + type = values.First(); + } + else + { + type = "image/png"; + } + return File(bytes, type); + } + /// /// Marks a gift message as read. /// @@ -426,21 +429,21 @@ public class PortalController : ControllerBase /// /// api/2.0/portal/present/mark /// POST - [HttpPost("present/mark")] - public void MarkPresentAsReaded() - { - try - { - var settings = _settingsManager.LoadForCurrentUser(); - settings.Readed = true; - _settingsManager.SaveForCurrentUser(settings); - } - catch (Exception ex) - { - _log.ErrorMarkPresentAsReaded(ex); - } - } - + [HttpPost("present/mark")] + public void MarkPresentAsReaded() + { + try + { + var settings = _settingsManager.LoadForCurrentUser(); + settings.Readed = true; + _settingsManager.SaveForCurrentUser(settings); + } + catch (Exception ex) + { + _log.ErrorMarkPresentAsReaded(ex); + } + } + /// /// Registers the mobile app installation. /// @@ -452,13 +455,13 @@ public class PortalController : ControllerBase /// /// api/2.0/portal/mobile/registration /// POST - [HttpPost("mobile/registration")] - public void RegisterMobileAppInstall(MobileAppRequestsDto inDto) - { - var currentUser = _userManager.GetUsers(_securityContext.CurrentAccount.ID); - _mobileAppInstallRegistrator.RegisterInstall(currentUser.Email, inDto.Type); - } - + [HttpPost("mobile/registration")] + public void RegisterMobileAppInstall(MobileAppRequestsDto inDto) + { + var currentUser = _userManager.GetUsers(_securityContext.CurrentAccount.ID); + _mobileAppInstallRegistrator.RegisterInstall(currentUser.Email, inDto.Type); + } + /// /// Registers the mobile app installation by mobile app type. /// @@ -471,11 +474,11 @@ public class PortalController : ControllerBase /// api/2.0/portal/mobile/registration /// POST /// false - [HttpPost("mobile/registration")] - public void RegisterMobileAppInstall(MobileAppType type) - { - var currentUser = _userManager.GetUsers(_securityContext.CurrentAccount.ID); - _mobileAppInstallRegistrator.RegisterInstall(currentUser.Email, type); + [HttpPost("mobile/registration")] + public void RegisterMobileAppInstall(MobileAppType type) + { + var currentUser = _userManager.GetUsers(_securityContext.CurrentAccount.ID); + _mobileAppInstallRegistrator.RegisterInstall(currentUser.Email, type); } /// @@ -797,5 +800,5 @@ public class PortalController : ControllerBase default: throw new SecurityException("Access Denied."); } - } + } } \ No newline at end of file