I must be missing something here. I know 1.6 will solve this but I need to implement this little security check now.
Below code works as expected, any authors can perform edit task in com_mycomponent.
Code:
// Setup permissions
$acl = & JFactory::getACL();
$acl->addACL( 'com_mycomponent', 'edit', 'users', 'author');
// Authorize user
$user =& JFactory::getUser();
$access = new stdClass();
$access->canEditOwn = $user->authorize('com_mycomponent', 'edit');
The below code does not work as expected. All authors are still allowed to perform edit task in com_mycomponent instead of the specific user.
Code:
// Setup permissions
$acl = & JFactory::getACL();
$acl->addACL( 'com_mycomponent', 'edit', 'users', 'author','mycomponent','own' );
// Authorize user
$user =& JFactory::getUser();
$access = new stdClass();
$access->canEditOwn = $user->authorize('com_mycomponent', 'edit', 'mycomponent', 'own');
I have scoured a good deal of core files but still cannot see how this works for com_content but not mycomponent. I know the created_by field exists for com_content but I don't see where this check is performed when authorizing a user. My component currently does not have a way of identifying who created it so how is this implemented?
Thanks.