fix Bug 63942

This commit is contained in:
Maksim Chegulov 2023-09-01 16:00:56 +03:00
parent 54b6742b6b
commit 4439425625
4 changed files with 268 additions and 268 deletions

View File

@ -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))

View File

@ -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();

View File

@ -352,9 +352,12 @@ public class UserController : PeopleControllerBase
[HttpPost("invite")]
public async Task<List<EmployeeDto>> 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);

View File

@ -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;
///<summary>
/// Portal information access.
///</summary>
///<name>portal</name>
[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<PortalController> _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<PortalController> _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<PortalController> 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<PortalController> 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;
}
}
/// <summary>
/// Returns the current portal.
@ -148,13 +148,13 @@ public class PortalController : ControllerBase
/// <returns type="ASC.Web.Api.ApiModels.ResponseDto.TenantDto, ASC.Web.Api">Current portal information</returns>
/// <path>api/2.0/portal</path>
/// <httpMethod>GET</httpMethod>
[AllowNotPayment]
[HttpGet("")]
public TenantDto Get()
{
return _mapper.Map<TenantDto>(Tenant);
}
[AllowNotPayment]
[HttpGet("")]
public TenantDto Get()
{
return _mapper.Map<TenantDto>(Tenant);
}
/// <summary>
/// Returns a user with the ID specified in the request from the current portal.
/// </summary>
@ -166,12 +166,12 @@ public class PortalController : ControllerBase
/// <returns type="ASC.Core.Users.UserInfo, ASC.Core.Common">User information</returns>
/// <path>api/2.0/portal/users/{userID}</path>
/// <httpMethod>GET</httpMethod>
[HttpGet("users/{userID}")]
public UserInfo GetUser(Guid userID)
{
return _userManager.GetUsers(userID);
}
[HttpGet("users/{userID}")]
public UserInfo GetUser(Guid userID)
{
return _userManager.GetUsers(userID);
}
/// <summary>
/// Returns an invitation link for joining the portal.
/// </summary>
@ -183,18 +183,21 @@ public class PortalController : ControllerBase
/// <returns type="System.Object, System">Invitation link</returns>
/// <path>api/2.0/portal/users/invite/{employeeType}</path>
/// <httpMethod>GET</httpMethod>
[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}";
}
/// <summary>
/// Returns a link specified in the request in the shortened format.
/// </summary>
@ -204,19 +207,19 @@ public class PortalController : ControllerBase
/// <returns type="System.Object, System">Shortened link</returns>
/// <path>api/2.0/portal/getshortenlink</path>
/// <httpMethod>PUT</httpMethod>
[HttpPut("getshortenlink")]
public async Task<object> 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<object> GetShortenLinkAsync(ShortenLinkRequestsDto inDto)
{
try
{
return await _urlShortener.Instance.GetShortenLinkAsync(inDto.Link);
}
catch (Exception ex)
{
_log.ErrorGetShortenLink(ex);
return inDto.Link;
}
}
/// <summary>
/// Returns an extra tenant license for the portal.
@ -229,37 +232,37 @@ public class PortalController : ControllerBase
/// <returns type="ASC.Web.Api.ApiModels.ResponseDto, ASC.Web.Api">Extra tenant license information</returns>
/// <path>api/2.0/portal/tenantextra</path>
/// <httpMethod>GET</httpMethod>
[AllowNotPayment, AllowAnonymous]
[HttpGet("tenantextra")]
public async Task<TenantExtraDto> GetTenantExtra(bool refresh)
[AllowNotPayment, AllowAnonymous]
[HttpGet("tenantextra")]
public async Task<TenantExtraDto> 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<TariffSettings>().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<TariffSettings>().LicenseAcceptSetting;
result.DocServerUserQuota = await _documentServiceLicense.GetLicenseQuotaAsync();
result.DocServerLicense = await _documentServiceLicense.GetLicenseAsync();
}
return result;
}
return result;
}
/// <summary>
/// Returns the used space of the current portal.
/// </summary>
@ -270,16 +273,16 @@ public class PortalController : ControllerBase
/// <returns type="System.Double, System">Used portal space</returns>
/// <path>api/2.0/portal/usedspace</path>
/// <httpMethod>GET</httpMethod>
[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);
}
/// <summary>
/// Returns a number of portal users.
/// </summary>
@ -290,12 +293,12 @@ public class PortalController : ControllerBase
/// <returns type="System.Int64, System">Number of portal users</returns>
/// <path>api/2.0/portal/userscount</path>
/// <httpMethod>GET</httpMethod>
[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;
}
/// <summary>
/// Returns the current portal tariff.
/// </summary>
@ -307,12 +310,12 @@ public class PortalController : ControllerBase
/// <returns type="ASC.Core.Billing.Tariff, ASC.Core.Common">Current portal tariff</returns>
/// <path>api/2.0/portal/tariff</path>
/// <httpMethod>GET</httpMethod>
[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);
}
/// <summary>
/// Returns the current portal quota.
@ -324,13 +327,13 @@ public class PortalController : ControllerBase
/// <returns type="ASC.Core.Tenants.TenantQuota, ASC.Core.Common">Current portal quota</returns>
/// <path>api/2.0/portal/quota</path>
/// <httpMethod>GET</httpMethod>
[AllowNotPayment]
[HttpGet("quota")]
public TenantQuota GetQuota()
{
return _tenantManager.GetTenantQuota(Tenant.Id);
}
[AllowNotPayment]
[HttpGet("quota")]
public TenantQuota GetQuota()
{
return _tenantManager.GetTenantQuota(Tenant.Id);
}
/// <summary>
/// Returns the recommended quota for the current portal.
/// </summary>
@ -341,19 +344,19 @@ public class PortalController : ControllerBase
/// <returns type="ASC.Core.Tenants.TenantQuota, ASC.Core.Common">Recommended portal quota</returns>
/// <path>api/2.0/portal/quota/right</path>
/// <httpMethod>GET</httpMethod>
[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);
}
/// <summary>
/// Returns the full absolute path to the current portal.
/// </summary>
@ -365,12 +368,12 @@ public class PortalController : ControllerBase
/// <returns type="System.Object, System">Portal path</returns>
/// <path>api/2.0/portal/path</path>
/// <httpMethod>GET</httpMethod>
[HttpGet("path")]
public object GetFullAbsolutePath(string virtualPath)
{
return _commonLinkUtility.GetFullAbsolutePath(virtualPath);
}
[HttpGet("path")]
public object GetFullAbsolutePath(string virtualPath)
{
return _commonLinkUtility.GetFullAbsolutePath(virtualPath);
}
/// <summary>
/// Returns a thumbnail of the bookmark URL specified in the request.
/// </summary>
@ -382,40 +385,40 @@ public class PortalController : ControllerBase
/// <returns type="Microsoft.AspNetCore.Mvc.FileResult, Microsoft.AspNetCore.Mvc">Thumbnail</returns>
/// <path>api/2.0/portal/thumb</path>
/// <httpMethod>GET</httpMethod>
[HttpGet("thumb")]
public FileResult GetThumb(string url)
{
if (!_securityContext.IsAuthenticated || _configuration["bookmarking:thumbnail-url"] == null)
{
return null;
}
url = url.Replace("&amp;", "&");
url = WebUtility.UrlEncode(url);
[HttpGet("thumb")]
public FileResult GetThumb(string url)
{
if (!_securityContext.IsAuthenticated || _configuration["bookmarking:thumbnail-url"] == null)
{
return null;
}
url = url.Replace("&amp;", "&");
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);
}
/// <summary>
/// Marks a gift message as read.
/// </summary>
@ -426,21 +429,21 @@ public class PortalController : ControllerBase
/// <returns></returns>
/// <path>api/2.0/portal/present/mark</path>
/// <httpMethod>POST</httpMethod>
[HttpPost("present/mark")]
public void MarkPresentAsReaded()
{
try
{
var settings = _settingsManager.LoadForCurrentUser<OpensourceGiftSettings>();
settings.Readed = true;
_settingsManager.SaveForCurrentUser(settings);
}
catch (Exception ex)
{
_log.ErrorMarkPresentAsReaded(ex);
}
}
[HttpPost("present/mark")]
public void MarkPresentAsReaded()
{
try
{
var settings = _settingsManager.LoadForCurrentUser<OpensourceGiftSettings>();
settings.Readed = true;
_settingsManager.SaveForCurrentUser(settings);
}
catch (Exception ex)
{
_log.ErrorMarkPresentAsReaded(ex);
}
}
/// <summary>
/// Registers the mobile app installation.
/// </summary>
@ -452,13 +455,13 @@ public class PortalController : ControllerBase
/// <returns></returns>
/// <path>api/2.0/portal/mobile/registration</path>
/// <httpMethod>POST</httpMethod>
[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);
}
/// <summary>
/// Registers the mobile app installation by mobile app type.
/// </summary>
@ -471,11 +474,11 @@ public class PortalController : ControllerBase
/// <path>api/2.0/portal/mobile/registration</path>
/// <httpMethod>POST</httpMethod>
/// <visible>false</visible>
[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);
}
/// <summary>
@ -797,5 +800,5 @@ public class PortalController : ControllerBase
default:
throw new SecurityException("Access Denied.");
}
}
}
}