thermal paste-yfry

This commit is contained in:
Michael 2017-03-26 13:21:14 -04:00
parent 8c265ebf36
commit 968ea14cae

View file

@ -284,8 +284,10 @@ public static void UpdateACLDefinitions(string fid)
if (forum.Permissions.Length < db.Roles.Count())
{
var rolesToAdd = db.Roles.Where(r => forum.Permissions.FirstOrDefault(p => p.RoleId == r.Id) == null);
foreach(var role in rolesToAdd)
var roles = db.Roles.ToArray();
foreach(var role in roles)
{
if (db.ForumPermissions.FirstOrDefault(x => x.CategoryId == fid && x.RoleId == role.Id) == null)
{
var perm = new ForumPermission();
perm.Id = Guid.NewGuid().ToString();
@ -295,6 +297,7 @@ public static void UpdateACLDefinitions(string fid)
db.ForumPermissions.Add(perm);
recordsAdded++;
}
}
db.AuditLogs.Add(new AuditLog("system", AuditLogLevel.Admin, $"Automatic forum ACL update occurred - Forum: {forum.Name}, records added: {recordsAdded}."));
db.SaveChanges();
}