This project is read-only.

Deleting Items

Topics: Developer Forum
Aug 26, 2008 at 12:19 PM

Hey,

we used n2 for a data collecting system. Within the system, every user, even anonymous user, should be able to delete items.

We try to do this with the line

N2.Context.Persister.Delete(element)

and i get the error message "Permission denied" for anoymous users.

What have i to do to make this work?


BR
Oliver

Aug 26, 2008 at 9:51 PM
When you use delete the item won't be deleted. Instead it will be expired and moved to the trash. The problem is that the anonymous users isn't allowed to save the item once it's expired. I think ist's the correct behaviour however your're not out of luck. You can...

...disable security before the delete:
            N2.Context.SecurityManager.ScopeEnabled = false;

...or prevent the item from beeing moved to the trashcan:
            [NotThrowable]
            public class ItemDeletableByUsers : ContentItem...