code reorg
This commit is contained in:
parent
d0c79e449d
commit
229971783a
52 changed files with 5721 additions and 14 deletions
|
|
@ -3,6 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
|||
using Microsoft.Extensions.Options;
|
||||
using rules;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Access;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.Services
|
||||
|
|
@ -98,7 +99,35 @@ namespace Yavsc.Services
|
|||
|
||||
public void SetAccess(long circleId, string normalizedFullPath, FileAccessRight access)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var acl = _dbContext.CircleAuthorizationToFile.SingleOrDefault(a =>
|
||||
a.CircleId == circleId && a.FileId == normalizedFullPath);
|
||||
|
||||
if (access == FileAccessRight.None)
|
||||
{
|
||||
if (acl != null)
|
||||
{
|
||||
_dbContext.CircleAuthorizationToFile.Remove(acl);
|
||||
}
|
||||
|
||||
_dbContext.SaveChanges();
|
||||
return;
|
||||
}
|
||||
|
||||
if (acl == null)
|
||||
{
|
||||
_dbContext.CircleAuthorizationToFile.Add(new CircleAuthorizationToFile
|
||||
{
|
||||
CircleId = circleId,
|
||||
FileId = normalizedFullPath,
|
||||
Access = access
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
acl.Access = access;
|
||||
}
|
||||
|
||||
_dbContext.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue