private object SetKeys(PrivacyRoomModel model) { PermissionContext.DemandPermissions(new UserSecurityProvider(AuthContext.CurrentAccount.ID), Constants.Action_EditUser); if (!PrivacyRoomSettings.GetEnabled(SettingsManager)) { throw new System.Security.SecurityException(); } var keyPair = EncryptionKeyPairHelper.GetKeyPair(); if (keyPair != null) { if (!string.IsNullOrEmpty(keyPair.PublicKey)) { return(new { isset = true }); } Log.InfoFormat("User {0} updates address", AuthContext.CurrentAccount.ID); } EncryptionKeyPairHelper.SetKeyPair(model.PublicKey, model.PrivateKeyEnc); return(new { isset = true }); }
private bool SetPrivacyRoom(PrivacyRoomModel model) { PermissionContext.DemandPermissions(SecutiryConstants.EditPortalSettings); if (model.Enable) { if (!PrivacyRoomSettings.IsAvailable(TenantManager)) { throw new BillingException(Resource.ErrorNotAllowedOption, "PrivacyRoom"); } } PrivacyRoomSettings.SetEnabled(TenantManager, SettingsManager, model.Enable); MessageService.Send(model.Enable ? MessageAction.PrivacyRoomEnable : MessageAction.PrivacyRoomDisable); return(model.Enable); }
public bool SetPrivacyRoomFromForm([FromForm] PrivacyRoomModel model) { return(SetPrivacyRoom(model)); }
public bool SetPrivacyRoomFromBody([FromBody] PrivacyRoomModel model) { return(SetPrivacyRoom(model)); }
public object SetKeysFromForm([FromForm] PrivacyRoomModel model) { return(SetKeys(model)); }
public object SetKeysFromBody([FromBody] PrivacyRoomModel model) { return(SetKeys(model)); }