Select the search type
  • Site
  • Web
Search
You are here:  Support/Forums
Support

Bring2mind Forums

All Permissions below an entry with permissions have been lost
Last Post 08/05/2010 11:37 AM by torheskje. 5 Replies.
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
torheskje
New Member
New Member
Posts:17


--
07/29/2010 10:02 AM

We use DMX version 5.1.3

The permissions on all Entries in the hierarchy below a 2nd level folder named Operations (with permissions) have been lost (left join DMX_EntryPermissions on DMX_EntryPermissions.EntryId=DMX_Entries.EntryId).

We have hard deleted a subfolder several levels below the Operations folder twice. The subfolders had folders with file entries. We have done this twice without notising that permissions on other files/folders have been affected.

When investigating a backup I found that all entries below Operations had permissions.

How can this happen?

What is the best/fastest way to recover, ie reestablish the permissions from the backup?

Any help would be highly appreciated.


Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
08/04/2010 10:28 PM
Hi Tor,

I have no clue how that can happen. AFAIK there is no code that rips out records from DMX_EntryPermissions. Instead they're wiped out because of the CASCADE DELETE on the foreign key to DMX_Entries. So ... I'm left guessing.

Peter
Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
08/04/2010 10:30 PM
To recover data from a backed up DB is tricky. But lets say you have the backup revived as a different DB alongside the latest (dirty) DB. Then you could try to retrieve data based on EntryId in the current DB and the Path field (which enables you to grab a part of the tree). Then move the records from DMX_EntryPermissions over. I've never done this before so I can't say for sure how this is done or if it is even possible.

Peter
torheskje
New Member
New Member
Posts:17


--
08/05/2010 12:07 AM

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       
 

Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
08/05/2010 10:54 AM
Hi Tor,

There is a permissions repair script under Admin > Run Scripts. NOTE: make a backup of the DB just in case before running this script. What it does is to check whether there are permissions defined, whther they are accessible to admins at least and that all items at least are visible and editable to admins.

Question: do I understand correctly that in your current system a new entry gets no permissions set?

Peter
torheskje
New Member
New Member
Posts:17


--
08/05/2010 11:37 AM

The system is currently working perfectly.

All entries have permissions and all new entries get permissions.

You are not authorized to post a reply.