65 Posts
Wissner
4 years ago
1
Topic

Hi there,

I created a plugin, which should delete all seblod articles of the category of "job" that are older than 6 weeks.

When the JCckContentArticle-object tries to delete an article, there is a "Permission denied" message in the log.

But when I call the same script from the backend as superuser, the delete action runs all ak.

The plugin is called by a cronjob once a day. 

Is there a way to give the script the rights to delete the article?

Can I manipulate the session of the script? Can I change the user group in a session?

My code:

$content = new JCckContentArticle;
$content->load($myid);
$ops = array(
'check_permissions'=>0,
);
$content->setOptions( $opts );
$content->delete();

Thank you for every hint. I know this might be a non-seblod solution, but maybe there are some seblod-feature which can help me.

Wolfgang

Get a VIP membership
65 Posts
Wissner
4 years ago
0
Level 1

I desided to change the workflow for this task.
For all articles with  the category "job" older than 6 weeks a cronjob triggers that the articles are put into the basket (state=-2)

When a super user enters the backend another plugin empties the basket by deleting all articles in it.

So the cron does trigger a action with super user rights.

Thank you 

Wolfgang

Get a VIP membership