The issue is closed on our installation. Below a description of the actions we took.
I ran the following script which restored the permissions from the backup:
/* Repair entries with empty permissions - copy permissions from backup */
Declare @myEntryId int
declare myCursor CURSOR LOCAL STATIC SCROLL READ_ONLY FOR
select e.EntryId
from DMX_Entries e left join DMX_EntryPermissions p on p.EntryId=e.EntryId
where p.RoleId is null and e.PortalId=0
OPEN myCursor
fetch next from myCursor into @myEntryId
while @@fetch_status = 0
begin
/*Copy permissions from backup database */
Insert into DMX_EntryPermissions (AllowAccess, EntryId, Expires,PermissionId,PortalId,RoleId,UserId)
select AllowAccess, EntryId, Expires,PermissionId,PortalId,RoleId,UserId from flagdm.dbo.DMX_EntryPermissions e2 where e2.EntryId=@myEntryId
fetch next from myCursor into @myEntryId
end
close myCursor
deallocate myCursor
In the time between the backup and the time of restoring permissions from the backup (and before the permissions disappeared), new files and folders had been created that had no permissions.
/* Repair entries with empty permissions - copy permissions from entry owner */
use flagdnn
Declare @myEntryId int, @myCollectionId int
declare myCursor CURSOR LOCAL STATIC SCROLL READ_ONLY FOR
select e.EntryId, e.CollectionId from DMX_Entries e left join DMX_EntryPermissions p on p.EntryId=e.EntryId
where p.RoleId is null and e.PortalId=0
OPEN myCursor
fetch next from myCursor into @myEntryId, @myCollectionId
while @@fetch_status = 0
begin
/*Copy permissions from entry owner */
Insert into DMX_EntryPermissions (AllowAccess, EntryId, Expires,PermissionId,PortalId,RoleId,UserId)
select AllowAccess, @myEntryId, Expires,PermissionId,PortalId,RoleId,UserId
from DMX_EntryPermissions e2 where e2.EntryId=@myCollectionId
fetch next from myCursor into @myEntryId, @myCollectionId
end
close myCursor
deallocate myCursor