Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
28

you need to add this to the constructor of your class protected $authSession; public function __construct( .... \Magento\Backend\Model\Auth\Session $authSession, .... ) { .... $this->authSession = $authSession; .... } Then create this method public function getCurrentUser() { return $this->authSession->getUser(); } ...


8

You can create user using userFactory /** * User model factory * * @var \Magento\User\Model\UserFactory */ protected $_userFactory; public function __construct( \Magento\User\Model\UserFactory $userFactory, ) { $this->_userFactory = $userFactory; } public function execute(){ $adminInfo = [ 'username' => 'killer', ...


8

After long research, I am able to resolve this problem. A mistake was in the format of XML . Initial code : <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Acl/etc/acl.xsd"> <acl> <resources> <resource id="...


7

How to get current admin user detail? inject backend session in your controller public function __construct( .... \Magento\Backend\Model\Auth\Session $authSession, .... ) { .... $this->authSession = $authSession; .... } and use this to get user name or email $this->authSession->getUser()->getUsername(); $this->authSession-&...


6

You can create the admin user by running the following command via SSH on the root directory level. php bin/magento admin:user:create --admin-user="admin" --admin-firstname="Admin" --admin-lastname="A" --admin-email="admin@admin.com" --admin-password="admin@5252"


6

You should know that it is not possible to find out which users are currently on the site, at least not with reasonable effort. The "online customers" list shows all customers that have been active within the last X minutes. Since there is no visitor log for admins, you don't have a "last active" time, as it is used for the "online customers" list. You can ...


5

I don't have a fully functional way of doing this, but I might have an idea. If you take a look at the Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Attributes class, the one that renders the attribute tabs on the products add/edit page, you will see this in the _prepareForm method if (Mage::registry('product')->hasLockedAttributes()) { ...


4

1- This tutorial may help you, it does exact the same thing you want but just for customer account Add Custom Field to Customer Address 2- Another rough method is that you override the magento core files, -> app/code/core/mage/adminhtml/block/permissions/users/edit/tab/main.php and add your desired field and then goto database admin_user table and add ...


4

It's the current admin password of the user you are logged in with, not the one you are about to create.


4

I have no idea what the problem might be, but you can still get access by creating another admin account: php bin/magento admin:user:create --admin-user="USERNAME_HERE" --admin-password="YOUR PASSWORD HERE" --admin-email="your-email-here@email.com" --admin-firstname="FIRST NAME HERE" --admin-lastname="LAST NAME HERE" After this you should use the new ...


4

Even I got the same notice message when I try to login into Magento2 adminpanel, after upgrading Magento2 from 2.3.1 to 2.3.2 For me it got solved after installing php version 7.2 and installing php7.2-sodium extension.


3

I think its too long to explain all things in answer, but I can give you starting point so you can start from something, Create a new product attribute with admin_user_id in assigned to all your product attribute set and perform reindex. Create a new observer for the catalog_product_save_before event. You can find the similar answer here Get product object ...


3

Your menu resource should match your acl resource. So in your case you need to replace: <resource id="Sup_Brand::shopbybrand" title="ShopByBrand" sortOrder="10" /> With: <resource id="Sup_Brand::sample" title="ShopByBrand" sortOrder="10" /> in your acl.xml


3

Try this- To get all user $adminUserModel = Mage::getModel('admin/user'); $userCollection = $adminUserModel->getCollection()->load(); print_r($userCollection->getData()); To get all the Roles $roles = Mage::getModel('admin/roles')->getCollection(); foreach($roles as $role): echo '<br/>Role : '.$role->getId()." | ".$role-&...


3

This is a really good idea and I would use such a module. I won't write the code for you, but here are some thoughts and pointers. unfortunately it is possible that an attacker creates an admin account without triggering the event. The shoplift exploit used SQL injection to get access to the database, then create an admin account there. I would suggest a ...


3

In theory you can set a lot of things in the extra column in a serialized format. But the core uses this to remember the expanded/collapsed fieldsets in the system->configuration sections. So each time you expand/collapse a config fieldset a request is made to admin/system_config/state/?container={fieldset_id}&value={1-expanded|0-collapsed}. the ...


3

Your Controller already extends \Magento\Backend\App\Action so it already has the authorization object. No additional injections are needed. To get the user simply use this function: /** @var \Magento\User\Model\User $user*/ $user = $this->_auth->getUser(); Other answers are suggesting duplicate injections, which are not needed.


3

Here we create admin user role programmatically by custom module installer with specific resources. First you need to create a installer file name InstallData.php in our custom module Setup folder complete path: app/code/ModuleNameSpace/YourModuleName/Setup <?php namespace ModuleNameSpace\YourModuleName\Setup; use Magento\Framework\...


3

If you are talking about attribute when editing products read here: Read-Only Product Backend attribute Edit: to make based on usesr permissions you can try this: create custom module add new ACL permission in adminhtml.xml <?xml version="1.0" encoding="UTF-8"?> <config> <acl> <resources> <admin> ...


2

You can observe the following events: admin user login success: backend_auth_user_login_success admin user login fail: backend_auth_user_login_failed In a module you can create the following etc/events.xml file: <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:...


2

Its working perfectly fine: RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123 RewriteCond %{REQUEST_URI} admin [NC] RewriteRule ^(.*)$ / [F,L]


2

You have to edit your .htaccess file and add the following: RewriteCond %{REMOTE_ADDR} !^123.123.123.123 Where 123.123.123.123 is your IP address from your factory. This below is addon to route to another path as the usual path is not recommended anyway. So you could use anything instead of /admin to access the backend. So for your needs you could change ...


2

This is temporary solution worked for me. D:\xampp\htdocs\Project\vendor\magento\module-user\Block\Role\Tab\Edit.php <?php /** * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\User\Block\Role\Tab; use Magento\Framework\App\ObjectManager; use Magento\User\Controller\Adminhtml\User\Role\...


2

I confirm what Manish reported. The problem sits in the acl.xml file. In my case (Magento 2.1) I had the following acl.xml: <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd"> <acl> <resources> <resource id="Magento_Backend::all_elements" title="...


2

The checkbox should be disabled if you are in a multistore environment and you don't have website selected when creating a customer. Select a website and it should become enabled.


2

change in your acl.xml with this line <resource id="Sup_Brand::sample" title="ShopByBrand" sortOrder="10" /> and also in your adminhtml controller, in your case it must be PATH_TO_YOUR_ADMIN_CONTROLLER/Items/Index add this function protected function _isAllowed() { return $this->_authorization->isAllowed('Sup_Brand::sample'); }


2

Create a file in root directory. for ex. admin.php <?php use Magento\Framework\App\Bootstrap; require 'app/bootstrap.php'; $bootstrap = Bootstrap::create(BP, $_SERVER); $objectManager = $bootstrap->getObjectManager(); $UserFactory = $objectManager->get('\Magento\User\Model\UserFactory'); try{ $adminInfo = [ 'username' => '...


2

Solution 1: add class in UI Componet In the UI Componet, add class for the creator_id: <column name="creator_id" class="Vendor\Module\Ui\Component\Listing\Column\CreatorName"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="filter" xsi:type="string">text</item> ...


2

You can write observer for admin edit action of attributes and allow to save only if the current admin login user is "Superadmin". You can use: catalog_product_attribute_update_before event for this purpose. Just go through Magento docs regarding events and observers.


2

Magento, by default, saves the password in CONCAT(MD5('qXyourpassword'),':qX') format, where 'qX' is salt value for encryption and it can be any other string and the string 'yourpassword' can be replaced by the user's password. If by any chance, the string qX is blank, then you can try decoding password using MD5 decode online tools. But in most of the case,...


Only top voted, non community-wiki answers of a minimum length are eligible