/// <summary> /// Filters the node set to nodes that are allowed for the user/permission combination /// </summary> /// <typeparam name="T"></typeparam> /// <param name="entities">The entities.</param> /// <param name="permissionId">The permission id.</param> /// <param name="permissionsyService">The permissionsy service.</param> /// <param name="userId">The user id.</param> /// <returns></returns> public static IEnumerable <T> FilterWithPermissions <T>(this IEnumerable <T> entities, Guid permissionId, IPermissionsService permissionsyService, HiveId userId) where T : IRelatableEntity { return(entities.Where(x => permissionsyService.GetEffectivePermission(permissionId, userId, x.Id).IsAllowed())); }