-
Notifications
You must be signed in to change notification settings - Fork 5
Implementing permissions for workflows #151
Conversation
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_COMPONENT_DESC" /> | ||
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC" /> | ||
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_COMPONENT_DESC" /> | ||
<action name="core.edit.own" title="JACTION_EDITOWN" description="JACTION_EDITOWN_COMPONENT_DESC" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps can add the transition execute action here, too. Then it could be inherit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's more clearer run.transition
stays within transition
*/ | ||
protected function allowEdit($data = array(), $key = 'id') | ||
{ | ||
$recordId = (int) isset($data[$key]) ? $data[$key] : 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, if the (int)
is not executed on the isset
if ($ownerId == $user->id) | ||
{ | ||
return true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return !empty($record) && $record->created_by == $user->id;
{ | ||
$user = Factory::getUser(); | ||
|
||
return ($user->authorise('core.create', $this->extension)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No brackets needed
|
||
$user = Factory::getUser(); | ||
$userId = $user->id; | ||
$isNew = ($this->item->id == 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!empty($this->item->id)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be empty($this->item->id)
since we check for new item
In favor of: #157 |
Pull Request for Issue #138 .
Summary of Changes
This implementation is to validate user's permission in workflow component. Similar to categories, workflow permission uses it's parent component's permission settings plus its own.
A new permission transition.run is used to indicate which users can perform a particular transition.
Testing Instructions
Setup Joomla CMS. Create user groups and change permissions. Create users for those groups, and check the visibility of different operations based on permissions