1

I 'm writing a listView's default layout for my component in which I 'm implementing Joomla's publish & unpublished feature in which user can publish an item on single click on check box. I am little confused about statement of getting user authentication for $canChange given below:

$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0;

can any body tell me way we authenticate user against com_checkin.?

secondly I think it is wrong, this should be like following:

$canCheckin = $user->authorise('core.manage', 'com_my_component') && $item->checked_out==$user->id || $item->checked_out==0;

In the above code I authenticate user against my component to make sure if user authorise for check_in, also I check if the the item is not checked to other user for editing

now the question is where is am I wrong and if I am right then why com_content authenticate user against com_checkin

1

com_checkin is a special component which allows user to check in all items in all components, clear the cache and purge the expired cache.

So when you authenticate a user against com_checkin you are making sure that this user has right to check in this item (if he has manage rights then he can check in any items).

  • okey sir thanks but i'm still confused what is the benefit of authenticating user against com_checkin though we can do same by authenticating manage authority against com_my_component.? – Sumer Raj Chouhan Mar 16 '15 at 5:50
  • You can do it in your component if you will create a special access rule like item.checkin in it. Otherwise you should check this for com_checkin. – Dmitry Rekun Mar 16 '15 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.