{"id":39731,"date":"2016-01-15T16:56:54","date_gmt":"2016-01-15T16:56:54","guid":{"rendered":"http:\/\/webkul.com\/blog\/?p=39731"},"modified":"2024-02-21T11:20:37","modified_gmt":"2024-02-21T11:20:37","slug":"magento-2-how-to-create-user-role-programmatically-by-custom-module-installer","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/","title":{"rendered":"Magento 2- How to create user role programmatically by custom module installer"},"content":{"rendered":"\n<p>Here we create admin user role programmatically by custom module installer with specific resources.<\/p>\n\n\n\n<p><strong>1=&gt;First you need to create an installer file named InstallData.php in our custom module Setup folder<\/strong><\/p>\n\n\n\n<p><strong>complete path<\/strong>: app\/code\/ModuleNameSpace\/YourModuleName\/Setup<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\nnamespace ModuleNameSpace\\YourModuleName\\Setup;\n\nuse Magento\\Framework\\Setup\\InstallDataInterface;\nuse Magento\\Framework\\Setup\\ModuleContextInterface;\nuse Magento\\Framework\\Setup\\ModuleDataSetupInterface;\n\n\/* For get RoleType and UserType for create Role   *\/;\nuse Magento\\Authorization\\Model\\Acl\\Role\\Group as RoleGroup;\nuse Magento\\Authorization\\Model\\UserContextInterface;\n\n\/**\n * @codeCoverageIgnore\n *\/\nclass InstallData implements InstallDataInterface\n{\n    \/**\n     * RoleFactory\n     *\n     * @var roleFactory\n     *\/\n    private $roleFactory;\n\n     \/**\n     * RulesFactory\n     *\n     * @var rulesFactory\n     *\/\n    private $rulesFactory;\n    \/**\n     * Init\n     *\n     * @param \\Magento\\Authorization\\Model\\RoleFactory $roleFactory\n     * @param \\Magento\\Authorization\\Model\\RulesFactory $rulesFactory\n     *\/\n    public function __construct(\n        \\Magento\\Authorization\\Model\\RoleFactory $roleFactory, \/* Instance of Role*\/\n        \\Magento\\Authorization\\Model\\RulesFactory $rulesFactory \/* Instance of Rule *\/ \n        \/*this define that which resource permitted to wich role *\/\n        )\n    {\n        $this-&gt;roleFactory = $roleFactory;\n        $this-&gt;rulesFactory = $rulesFactory;\n    }\n\n    \/**\n     * {@inheritdoc}\n     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)\n     *\/\n    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)\n    {\n        \/**\n        * Create Warehouse role \n        *\/\n        $role=$this-&gt;roleFactory-&gt;create();\n        $role-&gt;setName(&#039;YourRoleName&#039;) \/\/Set Role Name Which you want to create \n                -&gt;setPid(0) \/\/set parent role id of your role\n                -&gt;setRoleType(RoleGroup::ROLE_TYPE) \n                -&gt;setUserType(UserContextInterface::USER_TYPE_ADMIN);\n        $role-&gt;save();\n        \/* Now we set that which resources we allow to this role *\/\n        $resource=&#091;&#039;Magento_Backend::admin&#039;,\n\t\t\t\t\t&#039;Magento_Sales::sales&#039;,\n\t\t\t\t\t&#039;Magento_Sales::create&#039;,\n\t\t\t\t\t&#039;Magento_Sales::actions_view&#039;, \/\/you will use resource id which you want to allow\n\t\t\t\t\t&#039;Magento_Sales::cancel&#039;\n\t\t\t\t  ];\n        \/* Array of resource ids which we want to allow this role*\/\n        $this-&gt;rulesFactory-&gt;create()-&gt;setRoleId($role-&gt;getId())-&gt;setResources($resource)-&gt;saveRel();\n    }\n}<\/pre>\n\n\n\n<p>You can get resources id as explain in following snap<br><img decoding=\"async\" class=\"alignnone size-full wp-image-39733\" src=\"http:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Selection_056.png\" alt=\"ACL\" width=\"1122\" height=\"627\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Selection_056.png 1122w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Selection_056-250x140.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Selection_056-300x168.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Selection_056-768x429.png 768w\" sizes=\"(max-width: 1122px) 100vw, 1122px\" loading=\"lazy\" \/><\/p>\n\n\n\n<p>After adding these files install your custom module in your magento2 instance<\/p>\n\n\n\n<p>then by terminal run the following command in your magento2 root directory<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">php bin\/magento setup:upgrade<\/pre>\n\n\n\n<p><strong>Now\u00a0 your admin user role created\u00a0 you can check it from<\/strong> System &gt; Permission &gt; User Role as follows<strong> <\/strong>\ud83d\ude42<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"1268\" height=\"597\" src=\"http:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Selection_057.png\" alt=\"Selection_057\" class=\"wp-image-39736\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Selection_057.png 1268w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Selection_057-250x118.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Selection_057-300x141.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Selection_057-768x362.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Selection_057-1200x565.png 1200w\" sizes=\"(max-width: 1268px) 100vw, 1268px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"1155\" height=\"640\" src=\"http:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Selection_058.png\" alt=\"Selection_058\" class=\"wp-image-39738\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Selection_058.png 1155w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Selection_058-250x139.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Selection_058-300x166.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Selection_058-768x426.png 768w\" sizes=\"(max-width: 1155px) 100vw, 1155px\" loading=\"lazy\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Here we create admin user role programmatically by custom module installer with specific resources. 1=&gt;First you need to create an installer file named InstallData.php in our custom module Setup folder complete path: app\/code\/ModuleNameSpace\/YourModuleName\/Setup You can get resources id as explain in following snap After adding these files install your custom module in your magento2 instance <a href=\"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":4,"featured_media":39718,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,1],"tags":[2545,2580,2070,2547],"class_list":["post-39731","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-magento","category-uncategorized","tag-admin","tag-installer","tag-magento2","tag-role"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Magento 2- How to create user role programmatically by custom module installer - Webkul Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Magento 2- How to create user role programmatically by custom module installer - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"Here we create admin user role programmatically by custom module installer with specific resources. 1=&gt;First you need to create an installer file named InstallData.php in our custom module Setup folder complete path: app\/code\/ModuleNameSpace\/YourModuleName\/Setup You can get resources id as explain in following snap After adding these files install your custom module in your magento2 instance [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2016-01-15T16:56:54+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-02-21T11:20:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Magneto-Code-Snippet-5.png\" \/>\n\t<meta property=\"og:image:width\" content=\"825\" \/>\n\t<meta property=\"og:image:height\" content=\"260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Abhishek Singh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Abhishek Singh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/\"},\"author\":{\"name\":\"Abhishek Singh\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/573e459f54796eb4195511990de4bfd0\"},\"headline\":\"Magento 2- How to create user role programmatically by custom module installer\",\"datePublished\":\"2016-01-15T16:56:54+00:00\",\"dateModified\":\"2024-02-21T11:20:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/\"},\"wordCount\":104,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Magneto-Code-Snippet-5.png\",\"keywords\":[\"Admin\",\"installer\",\"Magento2\",\"Role\"],\"articleSection\":[\"magento\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/\",\"url\":\"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/\",\"name\":\"Magento 2- How to create user role programmatically by custom module installer - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Magneto-Code-Snippet-5.png\",\"datePublished\":\"2016-01-15T16:56:54+00:00\",\"dateModified\":\"2024-02-21T11:20:37+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Magneto-Code-Snippet-5.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Magneto-Code-Snippet-5.png\",\"width\":825,\"height\":260},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Magento 2- How to create user role programmatically by custom module installer\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/573e459f54796eb4195511990de4bfd0\",\"name\":\"Abhishek Singh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d4ac7e0e671bf743359d7e3f140c262d1b16d71106f0a1aeaecca327a2805ae4?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d4ac7e0e671bf743359d7e3f140c262d1b16d71106f0a1aeaecca327a2805ae4?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Abhishek Singh\"},\"description\":\"Adobe Commerce certified Magento developer with over 12 years of experience at Webkul. Passionate about scalable Magento 2-based webshops, AI, and multi-channel integrations, Abhishek consistently delivers innovative and efficient e-commerce solutions that propel businesses forward.\",\"sameAs\":[\"http:\/\/webkul.com\"],\"url\":\"https:\/\/webkul.com\/blog\/author\/abhishek\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Magento 2- How to create user role programmatically by custom module installer - Webkul Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/","og_locale":"en_US","og_type":"article","og_title":"Magento 2- How to create user role programmatically by custom module installer - Webkul Blog","og_description":"Here we create admin user role programmatically by custom module installer with specific resources. 1=&gt;First you need to create an installer file named InstallData.php in our custom module Setup folder complete path: app\/code\/ModuleNameSpace\/YourModuleName\/Setup You can get resources id as explain in following snap After adding these files install your custom module in your magento2 instance [...]","og_url":"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2016-01-15T16:56:54+00:00","article_modified_time":"2024-02-21T11:20:37+00:00","og_image":[{"width":825,"height":260,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Magneto-Code-Snippet-5.png","type":"image\/png"}],"author":"Abhishek Singh","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Abhishek Singh","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/"},"author":{"name":"Abhishek Singh","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/573e459f54796eb4195511990de4bfd0"},"headline":"Magento 2- How to create user role programmatically by custom module installer","datePublished":"2016-01-15T16:56:54+00:00","dateModified":"2024-02-21T11:20:37+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/"},"wordCount":104,"commentCount":2,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Magneto-Code-Snippet-5.png","keywords":["Admin","installer","Magento2","Role"],"articleSection":["magento"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/","url":"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/","name":"Magento 2- How to create user role programmatically by custom module installer - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Magneto-Code-Snippet-5.png","datePublished":"2016-01-15T16:56:54+00:00","dateModified":"2024-02-21T11:20:37+00:00","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Magneto-Code-Snippet-5.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Magneto-Code-Snippet-5.png","width":825,"height":260},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/magento-2-how-to-create-user-role-programmatically-by-custom-module-installer\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Magento 2- How to create user role programmatically by custom module installer"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/573e459f54796eb4195511990de4bfd0","name":"Abhishek Singh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d4ac7e0e671bf743359d7e3f140c262d1b16d71106f0a1aeaecca327a2805ae4?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d4ac7e0e671bf743359d7e3f140c262d1b16d71106f0a1aeaecca327a2805ae4?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Abhishek Singh"},"description":"Adobe Commerce certified Magento developer with over 12 years of experience at Webkul. Passionate about scalable Magento 2-based webshops, AI, and multi-channel integrations, Abhishek consistently delivers innovative and efficient e-commerce solutions that propel businesses forward.","sameAs":["http:\/\/webkul.com"],"url":"https:\/\/webkul.com\/blog\/author\/abhishek\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/39731","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=39731"}],"version-history":[{"count":9,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/39731\/revisions"}],"predecessor-version":[{"id":423446,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/39731\/revisions\/423446"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media\/39718"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=39731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=39731"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=39731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}