Fix PrivacyRoomController
This commit is contained in:
parent
5a959892ae
commit
e9b5992600
@ -97,7 +97,7 @@ server {
|
||||
}
|
||||
|
||||
location /api/2.0 {
|
||||
location ~* /(files|encryption) {
|
||||
location ~* /(files|encryption|privacyroom) {
|
||||
proxy_pass http://localhost:5007;
|
||||
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
|
||||
}
|
||||
|
9
products/ASC.Files/Core/Model/PrivacyRoomModel.cs
Normal file
9
products/ASC.Files/Core/Model/PrivacyRoomModel.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace ASC.Files.Core.Model
|
||||
{
|
||||
public class PrivacyRoomModel
|
||||
{
|
||||
public string PublicKey { get; set; }
|
||||
public string PrivateKeyEnc { get; set; }
|
||||
public bool Enable { get; set; }
|
||||
}
|
||||
}
|
@ -32,6 +32,7 @@ using ASC.Core;
|
||||
using ASC.Core.Billing;
|
||||
using ASC.Core.Common.Settings;
|
||||
using ASC.Core.Users;
|
||||
using ASC.Files.Core.Model;
|
||||
using ASC.MessagingSystem;
|
||||
using ASC.Web.Api.Routing;
|
||||
using ASC.Web.Core.PublicResources;
|
||||
@ -46,7 +47,7 @@ namespace ASC.Api.Documents
|
||||
{
|
||||
[DefaultRoute]
|
||||
[ApiController]
|
||||
public class PrivacyRoomApi : ControllerBase
|
||||
public class PrivacyRoomController : ControllerBase
|
||||
{
|
||||
private AuthContext AuthContext { get; }
|
||||
private PermissionContext PermissionContext { get; }
|
||||
@ -58,7 +59,7 @@ namespace ASC.Api.Documents
|
||||
private MessageService MessageService { get; }
|
||||
private ILog Log { get; }
|
||||
|
||||
public PrivacyRoomApi(
|
||||
public PrivacyRoomController(
|
||||
AuthContext authContext,
|
||||
PermissionContext permissionContext,
|
||||
SettingsManager settingsManager,
|
||||
@ -85,7 +86,7 @@ namespace ASC.Api.Documents
|
||||
/// </summary>
|
||||
/// <visible>false</visible>
|
||||
[Update("keys")]
|
||||
public object SetKeys(string publicKey, string privateKeyEnc)
|
||||
public object SetKeys(PrivacyRoomModel model)
|
||||
{
|
||||
PermissionContext.DemandPermissions(new UserSecurityProvider(AuthContext.CurrentAccount.ID), Constants.Action_EditUser);
|
||||
|
||||
@ -102,7 +103,7 @@ namespace ASC.Api.Documents
|
||||
Log.InfoFormat("User {0} updates address", AuthContext.CurrentAccount.ID);
|
||||
}
|
||||
|
||||
EncryptionKeyPairHelper.SetKeyPair(publicKey, privateKeyEnc);
|
||||
EncryptionKeyPairHelper.SetKeyPair(model.PublicKey, model.PrivateKeyEnc);
|
||||
|
||||
return new
|
||||
{
|
||||
@ -151,11 +152,11 @@ namespace ASC.Api.Documents
|
||||
/// <returns></returns>
|
||||
/// <visible>false</visible>
|
||||
[Update("")]
|
||||
public bool SetPrivacyRoom(bool enable)
|
||||
public bool SetPrivacyRoom(PrivacyRoomModel model)
|
||||
{
|
||||
PermissionContext.DemandPermissions(SecutiryConstants.EditPortalSettings);
|
||||
|
||||
if (enable)
|
||||
if (model.Enable)
|
||||
{
|
||||
if (!PrivacyRoomSettings.IsAvailable(TenantManager))
|
||||
{
|
||||
@ -163,11 +164,11 @@ namespace ASC.Api.Documents
|
||||
}
|
||||
}
|
||||
|
||||
PrivacyRoomSettings.SetEnabled(TenantManager, SettingsManager, enable);
|
||||
PrivacyRoomSettings.SetEnabled(TenantManager, SettingsManager, model.Enable);
|
||||
|
||||
MessageService.Send(enable ? MessageAction.PrivacyRoomEnable : MessageAction.PrivacyRoomDisable);
|
||||
MessageService.Send(model.Enable ? MessageAction.PrivacyRoomEnable : MessageAction.PrivacyRoomDisable);
|
||||
|
||||
return enable;
|
||||
return model.Enable;
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,7 +176,7 @@ namespace ASC.Api.Documents
|
||||
{
|
||||
public static DIHelper AddPrivacyRoomApiService(this DIHelper services)
|
||||
{
|
||||
if (services.TryAddScoped<PrivacyRoomApi>())
|
||||
if (services.TryAddScoped<PrivacyRoomController>())
|
||||
{
|
||||
services
|
||||
.AddAuthContextService()
|
||||
|
Loading…
Reference in New Issue
Block a user