{"id":1440,"date":"2013-10-13T13:03:48","date_gmt":"2013-10-13T11:03:48","guid":{"rendered":"http:\/\/www.extradrm.com\/?p=1440"},"modified":"2013-10-13T13:52:17","modified_gmt":"2013-10-13T11:52:17","slug":"acl-and-login-authentification-codeigniter-samples","status":"publish","type":"post","link":"https:\/\/www.extradrm.com\/?p=1440","title":{"rendered":"ACL and Login Authentification CodeIgniter samples"},"content":{"rendered":"<p>Usually when you are building a program, the login\/logout functionality is a must we always have to go through, so this quick tutorial will focus on this functionality, taking advantage of the benefits of using CodeIgniter instead of doing it from scratch in PHP. Below in CodeIgniter, before accessing home page via home controller we check if user_id is connected : if not it is redirected to login controller.\u00a0 This class session is part of the codeIgniter core (<a title=\"Managing CodeIgniter sessions in mysql \u2013 Part 2\" href=\"http:\/\/www.extradrm.com\/?p=709\">see configuration<\/a>) . Please note that all the application controllers(home\/login) are located within the same folder controller.<\/p>\n<div id=\"attachment_1445\" style=\"width: 755px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/www.extradrm.com\/wp-content\/uploads\/2013\/10\/ci_login_control.jpg\"><img aria-describedby=\"caption-attachment-1445\" loading=\"lazy\" class=\"size-full wp-image-1445\" alt=\"CodeIgnhiter Login sample check\" src=\"http:\/\/www.extradrm.com\/wp-content\/uploads\/2013\/10\/ci_login_control.jpg\" width=\"745\" height=\"469\" \/><\/a><p id=\"caption-attachment-1445\" class=\"wp-caption-text\">CodeIgnhiter Login sample check<\/p><\/div>\n<hr \/>\n<p>If we are working in HMVC combined to CodeIgniter, so we will have a cross module calls like below in function __construct.<\/p>\n<div id=\"attachment_1446\" style=\"width: 724px\" class=\"wp-caption alignleft\"><a href=\"http:\/\/www.extradrm.com\/wp-content\/uploads\/2013\/10\/hmvc_login_control.jpg\"><img aria-describedby=\"caption-attachment-1446\" loading=\"lazy\" class=\"size-full wp-image-1446 \" alt=\"Hmvc login control with codeIgniter\" src=\"http:\/\/www.extradrm.com\/wp-content\/uploads\/2013\/10\/hmvc_login_control.jpg\" width=\"714\" height=\"392\" \/><\/a><p id=\"caption-attachment-1446\" class=\"wp-caption-text\">Hmvc login control with codeIgniter<\/p><\/div>\n<hr \/>\n<h2>ACL : Access control List mecanism integrated to CodeIgniter :<\/h2>\n<p>ACL is the main controller which is dipatching permissions and roles to every user accessing controllers. In this module, ACL use an inherited view call declared in MY_Loader see this-&gt;load-&gt;view with 4 parameters below.<a href=\"http:\/\/www.extradrm.com\/wp-content\/uploads\/2013\/10\/acl_acl_control2.jpg\"><img loading=\"lazy\" class=\"size-full wp-image-1462\" alt=\"Acl CodeIgniter sample\" src=\"http:\/\/www.extradrm.com\/wp-content\/uploads\/2013\/10\/acl_acl_control2.jpg\" width=\"787\" height=\"444\" \/><\/a><\/p>\n<dl class=\"wp-caption alignleft\" id=\"attachment_1462\" style=\"width: 644px;\">\n<dd class=\"wp-caption-dd\">Acl CodeIgniter sample<\/dd>\n<\/dl>\n<hr \/>\n<p><a href=\"http:\/\/www.extradrm.com\/wp-content\/uploads\/2013\/10\/acl_perm_control.jpg\"><img loading=\"lazy\" class=\"alignleft size-full wp-image-1443\" alt=\"acl_perm_control\" src=\"http:\/\/www.extradrm.com\/wp-content\/uploads\/2013\/10\/acl_perm_control.jpg\" width=\"874\" height=\"315\" \/><\/a><\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n<hr \/>\n<div id=\"attachment_1442\" style=\"width: 929px\" class=\"wp-caption alignleft\"><a href=\"http:\/\/www.extradrm.com\/wp-content\/uploads\/2013\/10\/acl_user_control.jpg\"><img aria-describedby=\"caption-attachment-1442\" loading=\"lazy\" class=\"size-full wp-image-1442\" alt=\"acl_user_control\" src=\"http:\/\/www.extradrm.com\/wp-content\/uploads\/2013\/10\/acl_user_control.jpg\" width=\"919\" height=\"493\" \/><\/a><p id=\"caption-attachment-1442\" class=\"wp-caption-text\">ACL User control other than admin<\/p><\/div>\n<hr \/>\n<p>In this module, ACL use an inherited view call declared in MY_Loader where HMVC make MX_ inheritance too.<br \/>\nSo do not forget to add this function surcharged view in HMVC Loader in Application\/Core folder to use this ACL module with <a title=\"Setup HMVC with Codeigniter 2.1.3\" href=\"http:\/\/www.extradrm.com\/?p=744\">HMVC CodeIgniter variation<\/a>.<br \/>\n<a href=\"http:\/\/www.extradrm.com\/wp-content\/uploads\/2013\/10\/acl_heritage_view_control.jpg\"><img loading=\"lazy\" class=\"alignleft size-full wp-image-1441\" alt=\"acl_heritage_view_control\" src=\"http:\/\/www.extradrm.com\/wp-content\/uploads\/2013\/10\/acl_heritage_view_control.jpg\" width=\"1112\" height=\"346\" srcset=\"https:\/\/www.extradrm.com\/wp-content\/uploads\/2013\/10\/acl_heritage_view_control.jpg 1112w, https:\/\/www.extradrm.com\/wp-content\/uploads\/2013\/10\/acl_heritage_view_control-300x93.jpg 300w, https:\/\/www.extradrm.com\/wp-content\/uploads\/2013\/10\/acl_heritage_view_control-1024x318.jpg 1024w\" sizes=\"(max-width: 1112px) 100vw, 1112px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Usually when you are building a program, the login\/logout functionality is a must we always have to go through, so this quick tutorial will focus on this functionality, taking advantage of the benefits of&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":2841,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7,5,29],"tags":[205,242,243,244],"youtube_video":null,"_links":{"self":[{"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/posts\/1440"}],"collection":[{"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1440"}],"version-history":[{"count":0,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/posts\/1440\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/media\/2841"}],"wp:attachment":[{"href":"https:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1440"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}