This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -898,6 +898,41 @@ namespace AyaNova.Biz
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case AyaType.User:
|
||||
//USER MODIFIED SPECIAL
|
||||
//This one's a little different, if user has had roles changed, then pre-existing subs may not be allowed anymore
|
||||
//Remove any notification subscriptions user doesn't have rights to:
|
||||
if (((User)originalObject).Roles != ((User)newObject).Roles)
|
||||
{
|
||||
var DeleteList = new List<long>();
|
||||
var NewRoles = ((User)newObject).Roles;
|
||||
//iterate subs and remove any user shouldn't have
|
||||
var userSubs = await ct.NotifySubscription.Where(z => z.UserId == newObject.Id).ToListAsync();
|
||||
foreach (var sub in userSubs)
|
||||
{
|
||||
if (sub.AyaType != AyaType.NoType)
|
||||
{
|
||||
//check if user has rights to it or not still
|
||||
//must have read rights to be valid
|
||||
if (!AyaNova.Api.ControllerHelpers.Authorized.HasAnyRole(NewRoles, sub.AyaType))
|
||||
{
|
||||
//no rights whatsoever, so delete it
|
||||
DeleteList.Add(sub.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (DeleteList.Count > 0)
|
||||
{
|
||||
var NSB = NotifySubscriptionBiz.GetBiz(ct);
|
||||
foreach (var l in DeleteList)
|
||||
{
|
||||
await NSB.DeleteAsync(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
}//eoc
|
||||
|
||||
Reference in New Issue
Block a user