{"action":"closed","issue":{"url":"https://api.github.com/repos/panique/huge/issues/603","labels_url":"https://api.github.com/repos/panique/huge/issues/603/labels{/name}","comments_url":"https://api.github.com/repos/panique/huge/issues/603/comments","events_url":"https://api.github.com/repos/panique/huge/issues/603/events","html_url":"https://github.com/panique/huge/issues/603","id":57048998,"number":603,"title":"[feature discussion] Roles (partly done by the way, see admin feature)","user":{"login":"oisian","id":3748692,"avatar_url":"https://avatars.githubusercontent.com/u/3748692?v=3","gravatar_id":"","url":"https://api.github.com/users/oisian","html_url":"https://github.com/oisian","followers_url":"https://api.github.com/users/oisian/followers","following_url":"https://api.github.com/users/oisian/following{/other_user}","gists_url":"https://api.github.com/users/oisian/gists{/gist_id}","starred_url":"https://api.github.com/users/oisian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oisian/subscriptions","organizations_url":"https://api.github.com/users/oisian/orgs","repos_url":"https://api.github.com/users/oisian/repos","events_url":"https://api.github.com/users/oisian/events{/privacy}","received_events_url":"https://api.github.com/users/oisian/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":20,"created_at":"2015-02-09T15:56:56Z","updated_at":"2015-10-11T19:51:50Z","closed_at":"2015-10-11T19:51:50Z","body":"Hi, i'm not sure if this has been discussed or not yet, but i feel like user roles is part of the user creation/login process. so with a few tweeks to the database to allow roles to be assigned to a user, we could then have a function in the Auth class to check if they have the required roles to view a view or a controller. here is a quick thrown together example \r\n\r\n    public static function canUserAccsess($requiredRoles = array()) {\r\n        $Count = count($requiredRoles);\r\n        $i = 0;\r\n        while ($i < $Count) {      \r\n            $status =  (session::get('user_' . $requiredRoles[$i]) ? true : false ) ;\r\n            //return true as soon as one of the required roles is present.\r\n            if($status == true){\r\n                return true;\r\n            }\r\n            $i++;\r\n        }\r\n        //of non of them passed then we don't have the roles\r\n        return false;\r\n    }\r\n\r\nAnd then in the views or where ever we can simply do something like this.\r\n\r\n    if(Auth::canUserAccsess(['Sales','Admin'])){\r\n    echo \"We got in!\";\r\n    }"}}