File tree Expand file tree Collapse file tree 3 files changed +17
-23
lines changed
app/code/local/Egovs/Isolation
Block/Adminhtml/Permissions/User/Edit Expand file tree Collapse file tree 3 files changed +17
-23
lines changed Original file line number Diff line number Diff line change 11
11
*/
12
12
class Egovs_Isolation_Block_Adminhtml_Permissions_User_Edit_Tabs extends Mage_Adminhtml_Block_Permissions_User_Edit_Tabs
13
13
{
14
-
15
-
16
-
17
14
protected function _beforeToHtml ()
18
15
{
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
+ }
30
25
31
- }
32
-
33
26
return parent ::_beforeToHtml ();
34
27
}
35
-
36
28
}
Original file line number Diff line number Diff line change @@ -22,14 +22,16 @@ public function getUserStoreGroups()
22
22
$ user = Mage::getSingleton ('admin/session ' )->getUser ();
23
23
return $ user ->getStoreGroups ();
24
24
}
25
-
25
+
26
26
public function getUserIsAdmin ()
27
27
{
28
- $ user = Mage::getSingleton ('admin/session ' )->getUser ();
29
- return ($ user ->getRole ()->getId () == 1 );
28
+ return $ this ->isAdmin (Mage::getSingleton ('admin/session ' )->getUser ());
30
29
}
31
-
32
-
30
+
31
+ public function isAdmin ($ user ) {
32
+ return ($ user ->getRole ()->getId () == 1 );
33
+ }
34
+
33
35
public function getUsername ($ id )
34
36
{
35
37
$ user = Mage::getModel ('admin/user ' )->load ($ id );
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ public function onUserSave($observer)
20
20
$ stores = $ user ->getStoreGroups ();
21
21
Mage::getModel ('isolation/relation ' )->removeAllStoreRelations ($ user ->getId ());
22
22
23
- if (!Mage::helper ('isolation ' )->getUserIsAdmin ( )) {
23
+ if (!Mage::helper ('isolation ' )->isAdmin ( $ user )) {
24
24
if (is_array ($ stores )) {
25
25
foreach ($ stores as $ store ) {
26
26
$ store_relation = Mage::getModel ('isolation/relation ' );
You can’t perform that action at this time.
0 commit comments