mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 08:02:49 -05:00
share service setup
This commit is contained in:
@ -10,13 +10,19 @@ namespace Bit.Core.Services
|
||||
public class CipherService : ICipherService
|
||||
{
|
||||
private readonly ICipherRepository _cipherRepository;
|
||||
private readonly IShareRepository _shareRepository;
|
||||
private readonly IUserRepository _userRepository;
|
||||
private readonly IPushService _pushService;
|
||||
|
||||
public CipherService(
|
||||
ICipherRepository cipherRepository,
|
||||
IShareRepository shareRepository,
|
||||
IUserRepository userRepository,
|
||||
IPushService pushService)
|
||||
{
|
||||
_cipherRepository = cipherRepository;
|
||||
_shareRepository = shareRepository;
|
||||
_userRepository = userRepository;
|
||||
_pushService = pushService;
|
||||
}
|
||||
|
||||
@ -84,5 +90,24 @@ namespace Bit.Core.Services
|
||||
await _pushService.PushSyncCiphersAsync(userId.Value);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task ShareAsync(Share share, string email)
|
||||
{
|
||||
// TODO: Make sure share does not already exist between these two users.
|
||||
|
||||
var user = await _userRepository.GetByEmailAsync(email);
|
||||
if(user == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
share.UserId = user.Id;
|
||||
|
||||
// TODO: Permissions and status
|
||||
share.Permissions = null;
|
||||
share.Status = Enums.ShareStatusType.Accepted;
|
||||
|
||||
await _shareRepository.CreateAsync(share);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user