Skip to content

Commit

Permalink
V8: Send notifications for changes in permissions (#5287)
Browse files Browse the repository at this point in the history
  • Loading branch information
kjac authored and nul800sebastiaan committed Apr 23, 2019
1 parent e7f4f61 commit 61cc22d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Umbraco.Web/Compose/NotificationsComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ public void Initialize()
ContentService.RolledBack += (sender, args) => _notifier.Notify(_actions.GetAction<ActionRollback>(), args.Entity);

//Send notifications for the public access changed action
PublicAccessService.Saved += (sender, args) => PublicAccessServiceSaved(_notifier, sender, args, _contentService, _actions);
PublicAccessService.Saved += (sender, args) => PublicAccessServiceSaved(_notifier, sender, args, _contentService, _actions);

UserService.UserGroupPermissionsAssigned += (sender, args) => UserServiceUserGroupPermissionsAssigned(_notifier, sender, args, _contentService, _actions);
}

public void Terminate()
Expand Down Expand Up @@ -103,6 +105,16 @@ private void ContentServiceSaved(Notifier notifier, IContentService sender, Core
notifier.Notify(actions.GetAction<ActionNew>(), newEntities.ToArray());
notifier.Notify(actions.GetAction<ActionUpdate>(), updatedEntities.ToArray());
}

private void UserServiceUserGroupPermissionsAssigned(Notifier notifier, IUserService sender, Core.Events.SaveEventArgs<EntityPermission> args, IContentService contentService, ActionCollection actions)
{
var entities = contentService.GetByIds(args.SavedEntities.Select(e => e.EntityId)).ToArray();
if(entities.Any() == false)
{
return;
}
notifier.Notify(actions.GetAction<ActionRights>(), entities);
}

private void ContentServiceMoved(Notifier notifier, IContentService sender, Core.Events.MoveEventArgs<IContent> args, ActionCollection actions)
{
Expand Down

0 comments on commit 61cc22d

Please sign in to comment.