Skip to content

Commit 47cf06b

Browse files
committed
* Alle : Isolation : ZV_FM-1993 : Fix Store-Zuweisung
1 parent 5389a4a commit 47cf06b

File tree

3 files changed

+17
-23
lines changed

3 files changed

+17
-23
lines changed

app/code/local/Egovs/Isolation/Block/Adminhtml/Permissions/User/Edit/Tabs.php

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,18 @@
1111
*/
1212
class Egovs_Isolation_Block_Adminhtml_Permissions_User_Edit_Tabs extends Mage_Adminhtml_Block_Permissions_User_Edit_Tabs
1313
{
14-
15-
16-
1714
protected function _beforeToHtml()
1815
{
19-
20-
$user = Mage::registry('permissions_user');
21-
$r = $user->getRole();
22-
if($user->getRole()->getId() != 1)
23-
{
24-
$this->addTabAfter('user_section', array(
25-
'label' => Mage::helper('adminhtml')->__('Stores'),
26-
'title' => Mage::helper('adminhtml')->__('Stores'),
27-
'content' => $this->getLayout()->createBlock('isolation/adminhtml_permissions_user_edit_tabs_store')->toHtml(),
28-
29-
),'roles_section');
16+
$user = Mage::registry('permissions_user');
17+
18+
if(!Mage::helper('isolation')->isAdmin($user)) {
19+
$this->addTabAfter('user_section', array(
20+
'label' => Mage::helper('adminhtml')->__('Stores'),
21+
'title' => Mage::helper('adminhtml')->__('Stores'),
22+
'content' => $this->getLayout()->createBlock('isolation/adminhtml_permissions_user_edit_tabs_store')->toHtml(),
23+
),'roles_section');
24+
}
3025

31-
}
32-
3326
return parent::_beforeToHtml();
3427
}
35-
3628
}

app/code/local/Egovs/Isolation/Helper/Data.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ public function getUserStoreGroups()
2222
$user = Mage::getSingleton('admin/session')->getUser();
2323
return $user->getStoreGroups();
2424
}
25-
25+
2626
public function getUserIsAdmin()
2727
{
28-
$user = Mage::getSingleton('admin/session')->getUser();
29-
return ($user->getRole()->getId() == 1);
28+
return $this->isAdmin(Mage::getSingleton('admin/session')->getUser());
3029
}
31-
32-
30+
31+
public function isAdmin($user) {
32+
return ($user->getRole()->getId() == 1);
33+
}
34+
3335
public function getUsername($id)
3436
{
3537
$user = Mage::getModel('admin/user')->load($id);

app/code/local/Egovs/Isolation/Model/Observer/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function onUserSave($observer)
2020
$stores = $user->getStoreGroups();
2121
Mage::getModel('isolation/relation')->removeAllStoreRelations($user->getId());
2222

23-
if(!Mage::helper('isolation')->getUserIsAdmin()) {
23+
if(!Mage::helper('isolation')->isAdmin($user)) {
2424
if (is_array($stores)) {
2525
foreach ($stores as $store) {
2626
$store_relation = Mage::getModel('isolation/relation');

0 commit comments

Comments
 (0)