You knows that with jOOmla only publishers can publish there are situations with small groups I had requests for lowering the acl and permits to publish their articles also for authors. This is a very simple trick to do.
Locate these lines near the top of components/com_content/content.php
PHP:
-
// Editor usertype check
-
$access = new stdClass();
-
$access->canEdit = $acl->acl_check( 'action', 'edit', 'users', $my->usertype, 'content', 'all' );
-
$access->canEditOwn = $acl->acl_check( 'action', 'edit', 'users', $my->usertype, 'content', 'own' );
-
$access->canPublish = $acl->acl_check( 'action', 'publish', 'users', $my->usertype, 'content', 'all' );
And replace with:
PHP:
-
// Editor usertype check
-
$access = new stdClass();
-
// ---------------------------------------------------------------------------
-
// Marco 05.12.2005
-
// Show publish in frontend even for authors
-
// http://blog.nospace.net/
-
// ---------------------------------------------------------------------------
-
$acl->_mos_add_acl( 'action', 'publish', 'users', 'editor', 'content', 'all' );
-
$acl->_mos_add_acl( 'action', 'publish', 'users', 'author', 'content', 'all' );
-
// ---------------------------------------------------------------------------
-
$access->canEdit = $acl->acl_check( 'action', 'edit', 'users', $my->usertype, 'content', 'all' );
-
$access->canEditOwn = $acl->acl_check( 'action', 'edit', 'users', $my->usertype, 'content', 'own' );
-
$access->canPublish = $acl->acl_check( 'action', 'publish', 'users', $my->usertype, 'content', 'all' );
And then locate this lines:
PHP:
-
} else {
-
$row->sectionid = $sectionid;
-
$row->version = 0;
-
$row->state = 0; // <<<<----------- replace 0 with 1 if you wish publish checkbox auto checked
-
$row->ordering = 0;
-
$row->publish_down = 'Mai';
-
$row->creator = 0;
-
$row->modifier = 0;
-
$row->frontpage = 0;
-
}
that's all.
{ 8 } Comments
Thanks for this - its very helpful.
Hello Anthony I am glad this is useful for you.
Great help - thx a lot..
Now what is needed is a way for a author to see own unpublished items.. or ...to be able to restrict a editor to edit only own items
Do You know where the standard rights are defined ? As I understand your method is to add 2 new access rules to an existing list..
Anyway - your tip has given me the minimum usable solution - so txh again!
Thanks Frank.
The standard Access Controls rights are defined in includes/gacl.class.php.
I dunno if I have fully understand but I think that this component myContent can help you a lot.
After discovered I have no jOOmla site without it.
http://joomlicious.com/index.php?option=com_content&task=view&id=3&Itemid=25
That was a really good tip. thank you very much.
This is for Joomla 1.0.x; any idea for J! 1.5?
> This is for Joomla 1.0.x; any idea for J! 1.5?
In Joomla 1.5, you can do this by:
- locate and open libraries/joomla/user/authorization.php,
- locate function (constructor) JAuthorization($options = NULL) and a series of $this->addACL( ... ) within that function,
- now, add the following line:
$this->addACL( 'com_content', 'publish', 'users', 'author', 'content', 'all' );
That's it.
Alternatively you could edit libraries/joomla/user/user.php to modify function authorize(...) to look something like this:
function authorize( $acoSection, $aco, $axoSection = null, $axo = null )
{
/* This is a hack to enable authors to publish content automatically
* (without the content beeing waited for aproval)
/*
if (strcasecmp($acoSection, "com_content") == 0 && strcasecmp($aco, "publish") == 0
&& strcasecmp($axoSection, "content") == 0 && strcasecmp($axo, "all") == 0) {
if (strcasecmp($this->usertype, "Author") == 0) { // here you can also check against a specific user ID to enable only certain users to do that
return True;
}
}
*/
// the native calls (Check Mode 1) work on the user id, not the user type
$acl = & JFactory::getACL();
$value = $acl->getCheckMode() == 1 ? $this->id : $this->usertype;
return $acl->acl_check( $acoSection, $aco, 'users', $value, $axoSection, $axo );
}
Thanks Andrej.
Very useful contribute.
Marco
Post a Comment