{"id":7514,"date":"2015-07-18T03:25:11","date_gmt":"2015-07-18T03:25:11","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2015\/07\/18\/ui-router-and-satellizer-force-login-open-source-projects-sahat-satellizer\/"},"modified":"2015-07-18T03:25:11","modified_gmt":"2015-07-18T03:25:11","slug":"ui-router-and-satellizer-force-login-open-source-projects-sahat-satellizer","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2015\/07\/18\/ui-router-and-satellizer-force-login-open-source-projects-sahat-satellizer\/","title":{"rendered":"UI Router and Satellizer force login-open source projects sahat\/satellizer"},"content":{"rendered":"<p><img decoding=\"async\" src=\"http:\/\/unknownerror.org\/opensource\/sahat\/satellizer\/q\/stackoverflow\/28332587\/undefined\" \/> <strong>user4526623<\/strong><\/p>\n<p>the idea is to have role based authentication as discussed in the Repo readme.<\/p>\n<p>so the code for forbidding the unauthorised access to <code>\/profile<\/code> would be something like the following<\/p>\n<pre><code>  $stateProvider.state(\"profile\", {\n    url: \"\/profile\",\n    templateUrl: \"app\/profile\/profile.html\",\n    controller: \"ProfileCtrl\",\n    controllerAs: \"user\",\n    data: {\n      permissions: {\n        except: ['guest'],\n        redirectTo: 'sign_in'\n      }\n    }\n  });\n<\/code><\/pre>\n<p>given that you defined the <code>guest<\/code> role<\/p>\n<pre><code>definePermissions = function(Permission, Identity) {\n  Permission.defineRole('guest', function(stateParams) {\n    return !Identity.currentUser;\n  });\n};\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>user4526623 the idea is to have role based authentication as discussed in the Repo readme. so the code for forbidding the unauthorised access to \/profile would be something like the following $stateProvider.state(&#8220;profile&#8221;, { url: &#8220;\/profile&#8221;, templateUrl: &#8220;app\/profile\/profile.html&#8221;, controller: &#8220;ProfileCtrl&#8221;, controllerAs: &#8220;user&#8221;, data: { permissions: { except: [&#8216;guest&#8217;], redirectTo: &#8216;sign_in&#8217; } } }); given that you [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7514","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7514","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7514"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7514\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}