0

So I have run into a bit of a strange problem and can not seem to find a solution. Maybe someone has had the same issue and can shed some light.

I am writing a component and I am adding front end editing to it, but when I save my front end form I end up with the following error:

You are not permitted to use that link to directly access that page (#1).

I have tracked the issue down to the checkEditId() function in JController. It returns false because "I have somehow just arrived at the form without clicking on a link". So I understand that I somehow have to setUserState('com_component.context.item', $id); as the problem is that the "id" is not in the userstate session.

But where do I add that? I have tried adding it manually using the setUserState() function but that does not appear to work and I can also see that com_content does not do it like that?

How am I meant to tell Joomla that the user is allowed to edit the item - not from an ACL point of view but from a - he just clicked on the edit link point of view?

Søren Beck Jensen
  • 1,676
  • 1
  • 12
  • 22
  • what do you mean by _"How am I meant to tell Joomla that the user is allowed to edit the item - not from an ACL point of view but from a - he just clicked on the edit link point of view?"_ – Lodder Aug 02 '12 at 13:28
  • I just mean to say that for now I don't want to involve ACL, let's just assume that all logged in users can edit anything. So in other words I am not looking for an ACL related answer - simply an answer to how to I pass the checkEditId($context, $id) validation. – Søren Beck Jensen Aug 02 '12 at 13:43

1 Answers1

3

I was having the exact same problem. What solved it for me was to make sure the URL format was correct on the list view. So I had:

administrator/index.php?option=com_helloworld&view=offer&layout=edit&offer_id=27

but you need the URL as follows:

administrator/index.php?option=com_helloworld&task=offer.edit&offer_id=27

This ensures that the ID of the item being edited is added to the session scope which is then checked in checkEditId().

This should solve your problem.

Adam Rifat
  • 573
  • 2
  • 11