Re: Implemented OthAuth
I am just starting with CakePHP and maybe I misunderstand your question, but can't you just get the list of permissions the logged-in user has from the db (via groups_permissions/permissions tables?) and use that to generate menu? You can also just make menu based on just group memberships (not as dynamic, but fast) BTW, some future features I'd love to see - multiple group memberships as well as users_permissions mapping for giving permissions directly to users. Also maybe a guest group, so that you can enable global lockdown and treat non-logged in users as guests - in effect doing deny all access unless logged in or action is in the guest group permissions. -M Olivier Percebois-Garve wrote: 2. I'd like to gather the name of all the controller having restricted methods, and the names of the restricted methods ($othAuthRestrictions) in my layout. Basically I'm doing : if restricted build adminMenu else build userMenu Any ideas on how to achieve this ? olivvv Langdon Stevenson wrote: Hi rombeh I have the following code in the controllers that I want to protect: (note: extra $helpers and $components have been removed to simplify) class LeadersController extends AppController { var $name = 'Leaders'; //for php4 var $helpers = array('othAuth'); var $components = array('othAuth'); var $othAuthRestrictions = array('index'); function beforeFilter() { $auth_conf = array('auto_redirect' = true, 'login_page' = 'leaders/login', 'logout_page' = 'leaders/logout', 'access_page' = '/leaders', 'hashkey' = 'mYpERsOnALhaSHkeY', 'strict_gid_check' = false); $this-othAuth-controller = $this; $this-othAuth-init($auth_conf); $this-othAuth-check(); } function index () { // Action code ... } } That is all that is required to add to the controller to protect the index action, assuming that you have followed the othAuth setup instructions and have the required classes and DB tables in place. As mentioned in my previous post I also have a permission in the permission table like this: INSERT INTO `cake_permissions` VALUES (1,'leaders/index','2006-03-13 23:19:31','-00-00 00:00:00'); And a Groups-Permissions mapping that connects that permission to the desired user's group. As a side note, you have to check that your User has the right group ID assigned, and that their Active field is set to 1. Hope this is useful. Regards, Langdon rombeh wrote: hi Langdon Stevenson, Can u show me quick walkthrough (place some code too :D) in order to get it works thanks --050902020402050200070309 Content-Type: text/html; charset=ISO-8859-1 X-Google-AttachSize: 3096 !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html head meta content=text/html;charset=ISO-8859-1 http-equiv=Content-Type /head body bgcolor=#ff text=#00 Wow. I see that there is more and more othAuth users. I've two issues I'm not sure how to tackle.br Just wanna to know if some peoples are sharing the same concerns (and if crazylegs thought about that for the new version) br br 1.Sometimes I hit the login page while its seems that I am already logged. if I fill in the right login, then I got back the message br that credentials are wrong. But n fact after thatnbsp; if I enter manuallynbsp; thenbsp; url of a restricted method, I can access it. br I'm not sure how to reproduce this but it happened often during testing of code in restricted method. maybe it is related to my usebr of requestAction.br br 2. I'd like to gather the name of all the controller having restricted methods, and the names of the restricted methods ($othAuthRestrictions) br in my layout. Basically I'm doing :br if restricted build adminMenubr else build userMenubr Any ideas on how to achieve this ?br br olivvvbr br br Langdon Stevenson wrote: blockquote cite=[EMAIL PROTECTED] type=cite pre wrap=Hi rombeh I have the following code in the controllers that I want to protect: (note: extra $helpers and $components have been removed to simplify) class LeadersController extends AppController { var $name = 'Leaders'; //for php4 var $helpers = array('othAuth'); var $components = array('othAuth'); var $othAuthRestrictions = array('index'); function beforeFilter() { $auth_conf = array('auto_redirect' =gt; true, 'login_page' =gt; 'leaders/login', 'logout_page' =gt; 'leaders/logout', 'access_page' =gt; '/leaders', 'hashkey' =gt; 'mYpERsOnALhaSHkeY', 'strict_gid_check' =gt; false); $this-gt;othAuth-gt;controller = amp;$this; $this-gt;othAuth-gt;init($auth_conf); $this-gt;othAuth-gt;check(); } function index () { // Action code ... } } That is all that is required to add to the
Re: Implemented OthAuth
Hi CrazyLegs,Looking forward to the new version. Will the new version work with earlier versions of Cake?I do not want to have to switch to Cake 1.2 before it is ready.Do you have a time frame as to when your next version will be available? Thanx.Ryan On 7/1/06, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: Hi crazylegs, you don't have to worry, I think it's kinda normal at this step to have some little glitches. >From what I saw from the code, othAuth is cool piece of software. >From month to month I see the cake members and the cake-based code making giant steps, so I'm confident we will resolve such minor things pretty quick. Thanks for your code olivvv Langdon Stevenson wrote: Hi CraZyLegGsThanks for othAuth. I am pretty happy with the results of the current version. It does the job for me :-)ACL support would be awesome if you can get that in for the next version. I think that the greatest weakness of the current release is documentation. Step by step tutorial/s would be great for the next release :-)Looking forward to seeing the results, and am happy to beta test if you need it.Regards,LangdonCraZyLeGs wrote: Sorry for you all trying to implement othAuth and having a tough time!I'm working on a new version with more features: teaser, PersistentRemember me login, other modes ( user has many groups, ACL ), ajax safe...also looking forward to get ride of beforeFilter. cake 1.2 will havecomponent callbacks so othAuth might use those..I'll be doing a step by step tutorial, and will post the beta versionfor you guys to test when it's finished.. Thanks guys. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Implemented OthAuth
Hi Langdon,What controller did you end putting your code in?and what does your beforeFilter function look like so that we might be able to have the same success that you had?thanx.--Ryan On 6/30/06, Langdon Stevenson [EMAIL PROTECTED] wrote: Hi Olivier and RyanI have experienced all of the problems that you are now seeing.1. Constant redirecting to login page indicates that the Permissions andvar $othAuthRestrictions are not set up right.I was not able to get * to work to protect all actions.I didn't take the time to figure outwhy, as I didn't really need it.2. When I set up the login code in my Users controller I got errors likethis:Notice: Trying to get property of non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php on line 109Fatal error: Call to a member function find() on a non-object inC:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php on line 109 I moved the login code to another controller and it worked fine.Noidea why.3. You must have the beforeFilter initialise othAuth, particularly$othAuthRestrictions.I haven't dug around in the othAuth code enough to be able to really understand all of its logic, so sorry if this post doesn't provideenough info.Regards,Langdon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Implemented OthAuth
Sorry for you all trying to implement othAuth and having a tough time! I'm working on a new version with more features: teaser, Persistent Remember me login, other modes ( user has many groups, ACL ), ajax safe... also looking forward to get ride of beforeFilter. cake 1.2 will have component callbacks so othAuth might use those.. I'll be doing a step by step tutorial, and will post the beta version for you guys to test when it's finished.. Thanks guys. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Implemented OthAuth
Hi CraZyLegGs Thanks for othAuth. I am pretty happy with the results of the current version. It does the job for me :-) ACL support would be awesome if you can get that in for the next version. I think that the greatest weakness of the current release is documentation. Step by step tutorial/s would be great for the next release :-) Looking forward to seeing the results, and am happy to beta test if you need it. Regards, Langdon CraZyLeGs wrote: Sorry for you all trying to implement othAuth and having a tough time! I'm working on a new version with more features: teaser, Persistent Remember me login, other modes ( user has many groups, ACL ), ajax safe... also looking forward to get ride of beforeFilter. cake 1.2 will have component callbacks so othAuth might use those.. I'll be doing a step by step tutorial, and will post the beta version for you guys to test when it's finished.. Thanks guys. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Implemented OthAuth
Hi crazylegs, you don't have to worry, I think it's kinda normal at this step to have some little glitches. >From what I saw from the code, othAuth is cool piece of software. >From month to month I see the cake members and the cake-based code making giant steps, so I'm confident we will resolve such minor things pretty quick. Thanks for your code olivvv Langdon Stevenson wrote: Hi CraZyLegGs Thanks for othAuth. I am pretty happy with the results of the current version. It does the job for me :-) ACL support would be awesome if you can get that in for the next version. I think that the greatest weakness of the current release is documentation. Step by step tutorial/s would be great for the next release :-) Looking forward to seeing the results, and am happy to beta test if you need it. Regards, Langdon CraZyLeGs wrote: Sorry for you all trying to implement othAuth and having a tough time! I'm working on a new version with more features: teaser, Persistent Remember me login, other modes ( user has many groups, ACL ), ajax safe... also looking forward to get ride of beforeFilter. cake 1.2 will have component callbacks so othAuth might use those.. I'll be doing a step by step tutorial, and will post the beta version for you guys to test when it's finished.. Thanks guys. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Implemented OthAuth
hi Langdon Stevenson, Can u show me quick walkthrough (place some code too :D) in order to get it works thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Implemented OthAuth
Hi rombeh I have the following code in the controllers that I want to protect: (note: extra $helpers and $components have been removed to simplify) class LeadersController extends AppController { var $name = 'Leaders'; //for php4 var $helpers = array('othAuth'); var $components = array('othAuth'); var $othAuthRestrictions = array('index'); function beforeFilter() { $auth_conf = array('auto_redirect' = true, 'login_page' = 'leaders/login', 'logout_page' = 'leaders/logout', 'access_page' = '/leaders', 'hashkey' = 'mYpERsOnALhaSHkeY', 'strict_gid_check' = false); $this-othAuth-controller = $this; $this-othAuth-init($auth_conf); $this-othAuth-check(); } function index () { // Action code ... } } That is all that is required to add to the controller to protect the index action, assuming that you have followed the othAuth setup instructions and have the required classes and DB tables in place. As mentioned in my previous post I also have a permission in the permission table like this: INSERT INTO `cake_permissions` VALUES (1,'leaders/index','2006-03-13 23:19:31','-00-00 00:00:00'); And a Groups-Permissions mapping that connects that permission to the desired user's group. As a side note, you have to check that your User has the right group ID assigned, and that their Active field is set to 1. Hope this is useful. Regards, Langdon rombeh wrote: hi Langdon Stevenson, Can u show me quick walkthrough (place some code too :D) in order to get it works thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Implemented OthAuth
Wow. I see that there is more and more othAuth users. I've two issues I'm not sure how to tackle. Just wanna to know if some peoples are sharing the same concerns (and if crazylegs thought about that for the new version) 1.Sometimes I hit the login page while its seems that I am already logged. if I fill in the right login, then I got back the message that credentials are wrong. But n fact after that if I enter manually the url of a restricted method, I can access it. I'm not sure how to reproduce this but it happened often during testing of code in restricted method. maybe it is related to my use of requestAction. 2. I'd like to gather the name of all the controller having restricted methods, and the names of the restricted methods ($othAuthRestrictions) in my layout. Basically I'm doing : if restricted build adminMenu else build userMenu Any ideas on how to achieve this ? olivvv Langdon Stevenson wrote: Hi rombeh I have the following code in the controllers that I want to protect: (note: extra $helpers and $components have been removed to simplify) class LeadersController extends AppController { var $name = 'Leaders'; //for php4 var $helpers = array('othAuth'); var $components = array('othAuth'); var $othAuthRestrictions = array('index'); function beforeFilter() { $auth_conf = array('auto_redirect' = true, 'login_page' = 'leaders/login', 'logout_page' = 'leaders/logout', 'access_page' = '/leaders', 'hashkey' = 'mYpERsOnALhaSHkeY', 'strict_gid_check' = false); $this-othAuth-controller = $this; $this-othAuth-init($auth_conf); $this-othAuth-check(); } function index () { // Action code ... } } That is all that is required to add to the controller to protect the index action, assuming that you have followed the othAuth setup instructions and have the required classes and DB tables in place. As mentioned in my previous post I also have a permission in the permission table like this: INSERT INTO `cake_permissions` VALUES (1,'leaders/index','2006-03-13 23:19:31','-00-00 00:00:00'); And a Groups-Permissions mapping that connects that permission to the desired user's group. As a side note, you have to check that your User has the right group ID assigned, and that their Active field is set to "1". Hope this is useful. Regards, Langdon rombeh wrote: hi Langdon Stevenson, Can u show me quick walkthrough (place some code too :D) in order to get it works thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Implemented OthAuth
Hi Langdon,Cna you help me get past a raher mundane aspect of using othAuth?I have added othAuth to my cake install and all appears to be fine.I try to get to a restricted area and it redirects to the login page. I enter the login credentials and then I get this error once I click the submit button: Notice: Trying to get property of non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php on line 109 Fatal error: Call to a member function find() on a non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php on line 109The login page has access to the User object. I have even added the $users = array('User'); to the controller to see if that was what it needed but I still can not get past this. Any help would be appreciated. thanx.On 6/30/06, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: Wow. I see that there is more and more othAuth users. I've two issues I'm not sure how to tackle. Just wanna to know if some peoples are sharing the same concerns (and if crazylegs thought about that for the new version) 1.Sometimes I hit the login page while its seems that I am already logged. if I fill in the right login, then I got back the message that credentials are wrong. But n fact after that if I enter manually the url of a restricted method, I can access it. I'm not sure how to reproduce this but it happened often during testing of code in restricted method. maybe it is related to my use of requestAction. 2. I'd like to gather the name of all the controller having restricted methods, and the names of the restricted methods ($othAuthRestrictions) in my layout. Basically I'm doing : if restricted build adminMenu else build userMenu Any ideas on how to achieve this ? olivvv Langdon Stevenson wrote: Hi rombehI have the following code in the controllers that I want to protect:(note: extra $helpers and $components have been removed to simplify)class LeadersController extends AppController { var $name = 'Leaders'; //for php4 var $helpers = array('othAuth'); var $components = array('othAuth'); var $othAuthRestrictions = array('index'); function beforeFilter() { $auth_conf = array('auto_redirect' = true, 'login_page' = 'leaders/login', 'logout_page' = 'leaders/logout', 'access_page' = '/leaders', 'hashkey' = 'mYpERsOnALhaSHkeY', 'strict_gid_check' = false); $this-othAuth-controller = $this; $this-othAuth-init($auth_conf); $this-othAuth-check(); } function index () { // Action code ... }}That is all that is required to add to the controller to protect the index action, assuming that you have followed the othAuth setup instructions and have the required classes and DB tables in place. As mentioned in my previous post I also have a permission in the permission table like this:INSERT INTO `cake_permissions` VALUES (1,'leaders/index','2006-03-13 23:19:31','-00-00 00:00:00'); And a Groups-Permissions mapping that connects that permission to the desired user's group.As a side note, you have to check that your User has the right group ID assigned, and that their Active field is set to 1. Hope this is useful.Regards,Langdonrombeh wrote: hi Langdon Stevenson,Can u show me quick walkthrough (place some code too :D) in order toget it worksthanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Implemented OthAuth
can you paste your code ? (in cakebin for instance) Ryan Petrain wrote: Hi Langdon, Cna you help me get past a raher mundane aspect of using othAuth? I have added othAuth to my cake install and all appears to be fine. I try to get to a restricted area and it redirects to the login page. I enter the login credentials and then I get this error once I click the submit button: Notice: Trying to get property of non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php on line 109 Fatal error: Call to a member function find() on a non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php on line 109 The login page has access to the User object. I have even added the $users = array('User'); to the controller to see if that was what it needed but I still can not get past this. Any help would be appreciated. thanx. On 6/30/06, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: Wow. I see that there is more and more othAuth users. I've two issues I'm not sure how to tackle. Just wanna to know if some peoples are sharing the same concerns (and if crazylegs thought about that for the new version) 1.Sometimes I hit the login page while its seems that I am already logged. if I fill in the right login, then I got back the message that credentials are wrong. But n fact after that if I enter manually the url of a restricted method, I can access it. I'm not sure how to reproduce this but it happened often during testing of code in restricted method. maybe it is related to my use of requestAction. 2. I'd like to gather the name of all the controller having restricted methods, and the names of the restricted methods ($othAuthRestrictions) in my layout. Basically I'm doing : if restricted build adminMenu else build userMenu Any ideas on how to achieve this ? olivvv Langdon Stevenson wrote: Hi rombeh I have the following code in the controllers that I want to protect: (note: extra $helpers and $components have been removed to simplify) class LeadersController extends AppController { var $name = 'Leaders'; //for php4 var $helpers = array('othAuth'); var $components = array('othAuth'); var $othAuthRestrictions = array('index'); function beforeFilter() { $auth_conf = array('auto_redirect' = true, 'login_page' = 'leaders/login', 'logout_page' = 'leaders/logout', 'access_page' = '/leaders', 'hashkey' = 'mYpERsOnALhaSHkeY', 'strict_gid_check' = false); $this-othAuth-controller = $this; $this-othAuth-init($auth_conf); $this-othAuth-check(); } function index () { // Action code ... } } That is all that is required to add to the controller to protect the index action, assuming that you have followed the othAuth setup instructions and have the required classes and DB tables in place. As mentioned in my previous post I also have a permission in the permission table like this: INSERT INTO `cake_permissions` VALUES (1,'leaders/index','2006-03-13 23:19:31','-00-00 00:00:00'); And a Groups-Permissions mapping that connects that permission to the desired user's group. As a side note, you have to check that your User has the right group ID assigned, and that their Active field is set to "1". Hope this is useful. Regards, Langdon rombeh wrote: hi Langdon Stevenson, Can u show me quick walkthrough (place some code too :D) in order to get it works thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Implemented OthAuth
Hi Olivier,This is the user controller that handles the login. What other code do you need?class UsersController extends AppController{ var $name = Users; var $components = array('othAuth'); //var $othAuthRestrictions = array('index','view'); var $othAuthRestrictions = null; var $uses = array('User'); function login() { $this-layout = 'nosearchbar'; if(isset($this-params['data'])) { //$this-flash(print_r($this-params['data']),'/users/login'); $auth_num = $this-othAuth-login($this-params['data']['User']); $this-set('auth_msg', $this-othAuth-getMsg($auth_num)); } } function logout() { $this-othAuth-logout(); $this-flash('You are not logged in!','/users/login'); } }?On 6/30/06, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: can you paste your code ? (in cakebin for instance) Ryan Petrain wrote: Hi Langdon, Cna you help me get past a raher mundane aspect of using othAuth? I have added othAuth to my cake install and all appears to be fine. I try to get to a restricted area and it redirects to the login page. I enter the login credentials and then I get this error once I click the submit button: Notice: Trying to get property of non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php on line 109 Fatal error: Call to a member function find() on a non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php on line 109 The login page has access to the User object. I have even added the $users = array('User'); to the controller to see if that was what it needed but I still can not get past this. Any help would be appreciated. thanx. On 6/30/06, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: Wow. I see that there is more and more othAuth users. I've two issues I'm not sure how to tackle. Just wanna to know if some peoples are sharing the same concerns (and if crazylegs thought about that for the new version) 1.Sometimes I hit the login page while its seems that I am already logged. if I fill in the right login, then I got back the message that credentials are wrong. But n fact after that if I enter manually the url of a restricted method, I can access it. I'm not sure how to reproduce this but it happened often during testing of code in restricted method. maybe it is related to my use of requestAction. 2. I'd like to gather the name of all the controller having restricted methods, and the names of the restricted methods ($othAuthRestrictions) in my layout. Basically I'm doing : if restricted build adminMenu else build userMenu Any ideas on how to achieve this ? olivvv Langdon Stevenson wrote: Hi rombehI have the following code in the controllers that I want to protect:(note: extra $helpers and $components have been removed to simplify)class LeadersController extends AppController { var $name = 'Leaders'; //for php4 var $helpers = array('othAuth'); var $components = array('othAuth'); var $othAuthRestrictions = array('index'); function beforeFilter() { $auth_conf = array('auto_redirect' = true, 'login_page' = 'leaders/login', 'logout_page' = 'leaders/logout', 'access_page' = '/leaders', 'hashkey' = 'mYpERsOnALhaSHkeY', 'strict_gid_check' = false); $this-othAuth-controller = $this; $this-othAuth-init($auth_conf); $this-othAuth-check(); } function index () { // Action code ... }}That is all that is required to add to the controller to protect the index action, assuming that you have followed the othAuth setup instructions and have the required classes and DB tables in place. As mentioned in my previous post I also have a permission in the permission table like this:INSERT INTO `cake_permissions` VALUES (1,'leaders/index','2006-03-13 23:19:31','-00-00 00:00:00'); And a Groups-Permissions mapping that connects that permission to the desired user's group.As a side note, you have to check that your User has the right group ID assigned, and that their Active field is set to 1. Hope this is useful.Regards,Langdonrombeh wrote: hi Langdon Stevenson,Can u show me quick walkthrough (place some code too :D) in order toget it worksthanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Implemented OthAuth
I still can't get it work, here's my code (I'm trying to protect entire controllers action): ? / *** /apps/app_controller.php */ class AppController extends Controller { var $helpers = array('Html','Javascript','Ajax','othAuth'); var $components = array('othAuth','RequestHandler'); var $othAuthRestrictions = *; function beforeFilter() { $auth_conf = array('auto_redirect' = true, 'login_page' = '/users/login', 'logout_page' = '/users/logout', 'access_page' = '/autocars/index', 'hashkey' = 'Wh4theV3rHaSHKeYz', 'strict_gid_check' = false); $this-othAuth-controller = $this; $this-othAuth-init($auth_conf); $this-othAuth-check(); } } I've routed base path (/) to /autocars/index but when I try to access www.myweb.com I got this error: Notice: Undefined index: url in /home/projects/autoindonesia_admin_area/apps/autoadmin/controllers/components/oth_auth.php on line 181 Notice: Undefined index: url in /home/projects/autoindonesia_admin_area/apps/autoadmin/controllers/components/oth_auth.php on line 182 Warning: Cannot modify header information - headers already sent by (output started at /home/projects/autoindonesia_admin_area/apps/autoadmin/controllers/components/oth_auth.php:181) in /home/projects/autoindonesia_admin_area/lib/cake/cake/libs/controller/controller.php on line 391 I can succesfully redirect to login page only if I access page via full url: www.myweb.com/autocars/index, if I try to login, I got 'succes login' message ('You're Logged in!'), but still can't get acces to any controller's action (succes login doesn't redirect me to acces_page, but stay in the login page), and I always redirected to my login page thx --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Implemented OthAuth
Ryan, I think you need a before filter, I have this : function beforeFilter() { $auth_conf = array( 'auto_redirect' = true, 'login_page' = 'categories/login', 'logout_page' = 'categories/view', 'access_page' = 'categories/login', 'hashkey' = 'MySEcEeTHaSHKeYz'); $this-othAuth-controller = $this; $this-othAuth-init($auth_conf); $this-othAuth-check(); } Sorry I'm in hurry got to go see Germany win. I'll look at your code later if I can. If you want you can have a look at how I implemented it in chameleon in cakeforge (take the svn, the package is old and broke) Ryan Petrain wrote: Hi Olivier, This is the user controller that handles the login. What other code do you need? class UsersController extends AppController { var $name = "Users"; var $components = array('othAuth'); //var $othAuthRestrictions = array('index','view'); var $othAuthRestrictions = null; var $uses = array('User'); function login() { $this-layout = 'nosearchbar'; if(isset($this-params['data'])) { //$this-flash(print_r($this-params['data']),'/users/login'); $auth_num = $this-othAuth-login($this-params['data']['User']); $this-set('auth_msg', $this-othAuth-getMsg($auth_num)); } } function logout() { $this-othAuth-logout(); $this-flash('You are not logged in!','/users/login'); } } ? On 6/30/06, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: can you paste your code ? (in cakebin for instance) Ryan Petrain wrote: Hi Langdon, Cna you help me get past a raher mundane aspect of using othAuth? I have added othAuth to my cake install and all appears to be fine. I try to get to a restricted area and it redirects to the login page. I enter the login credentials and then I get this error once I click the submit button: Notice: Trying to get property of non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php on line 109 Fatal error: Call to a member function find() on a non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php on line 109 The login page has access to the User object. I have even added the $users = array('User'); to the controller to see if that was what it needed but I still can not get past this. Any help would be appreciated. thanx. On 6/30/06, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: Wow. I see that there is more and more othAuth users. I've two issues I'm not sure how to tackle. Just wanna to know if some peoples are sharing the same concerns (and if crazylegs thought about that for the new version) 1.Sometimes I hit the login page while its seems that I am already logged. if I fill in the right login, then I got back the message that credentials are wrong. But n fact after that if I enter manually the url of a restricted method, I can access it. I'm not sure how to reproduce this but it happened often during testing of code in restricted method. maybe it is related to my use of requestAction. 2. I'd like to gather the name of all the controller having restricted methods, and the names of the restricted methods ($othAuthRestrictions) in my layout. Basically I'm doing : if restricted build adminMenu else build userMenu Any ideas on how to achieve this ? olivvv Langdon Stevenson wrote: Hi rombeh I have the following code in the controllers that I want to protect: (note: extra $helpers and $components have been removed to simplify) class LeadersController extends AppController { var $name = 'Leaders'; //for php4 var $helpers = array('othAuth'); var $components = array('othAuth'); var $othAuthRestrictions = array('index'); function beforeFilter() { $auth_conf = array('auto_redirect' = true, 'login_page' = 'leaders/login', 'logout_page' = 'leaders/logout', 'access_page' = '/leaders', 'hashkey' = 'mYpERsOnALhaSHkeY', 'strict_gid_check' = false); $this-othAuth-controller = $this; $this-othAuth-init($auth_conf); $this-othAuth-check(); } function index () { // Action code ... } } That is all that is required to add to the controller to protect the index action, assuming that you have followed the othAuth setup instructions and have the required classes and DB tables in place. As mentioned in my previous post I also have a permission in the permission table like this: INSERT INTO `cake_permissions` VALUES (1,'leaders/index','2006-03-13 23:19:31','-00-00 00:00:00'); And a Groups-Permissions mapping that connects that permission to the desired user's group. As a side note, you have to check that your User has the right group ID assigned, and that their Active field is set to "1". Hope this is useful. Regards, Langdon rombeh wrote: hi
Re: Implemented OthAuth
Olivier,I am not getting that error, but when I visit a restricted page it redirects me to the login (good), I login with proper credentials, and then it redirects me to the login again.Any ideas on what I am still doing wrong? thanx for all your help so far.On 6/30/06, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: Ryan, I think you need a before filter, I have this : function beforeFilter() { $auth_conf = array( 'auto_redirect' = true, 'login_page' = 'categories/login', 'logout_page' = 'categories/view', 'access_page' = 'categories/login', 'hashkey' = 'MySEcEeTHaSHKeYz'); $this-othAuth-controller = $this; $this-othAuth-init($auth_conf); $this-othAuth-check(); } Sorry I'm in hurry got to go see Germany win. I'll look at your code later if I can. If you want you can have a look at how I implemented it in chameleon in cakeforge (take the svn, the package is old and broke) Ryan Petrain wrote: Hi Olivier, This is the user controller that handles the login. What other code do you need? class UsersController extends AppController { var $name = Users; var $components = array('othAuth'); //var $othAuthRestrictions = array('index','view'); var $othAuthRestrictions = null; var $uses = array('User'); function login() { $this-layout = 'nosearchbar'; if(isset($this-params['data'])) { //$this-flash(print_r($this-params['data']),'/users/login'); $auth_num = $this-othAuth-login($this-params['data']['User']); $this-set('auth_msg', $this-othAuth-getMsg($auth_num)); } } function logout() { $this-othAuth-logout(); $this-flash('You are not logged in!','/users/login'); } } ? On 6/30/06, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: can you paste your code ? (in cakebin for instance) Ryan Petrain wrote: Hi Langdon, Cna you help me get past a raher mundane aspect of using othAuth? I have added othAuth to my cake install and all appears to be fine. I try to get to a restricted area and it redirects to the login page. I enter the login credentials and then I get this error once I click the submit button: Notice: Trying to get property of non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php on line 109 Fatal error: Call to a member function find() on a non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php on line 109 The login page has access to the User object. I have even added the $users = array('User'); to the controller to see if that was what it needed but I still can not get past this. Any help would be appreciated. thanx. On 6/30/06, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: Wow. I see that there is more and more othAuth users. I've two issues I'm not sure how to tackle. Just wanna to know if some peoples are sharing the same concerns (and if crazylegs thought about that for the new version) 1.Sometimes I hit the login page while its seems that I am already logged. if I fill in the right login, then I got back the message that credentials are wrong. But n fact after that if I enter manually the url of a restricted method, I can access it. I'm not sure how to reproduce this but it happened often during testing of code in restricted method. maybe it is related to my use of requestAction. 2. I'd like to gather the name of all the controller having restricted methods, and the names of the restricted methods ($othAuthRestrictions) in my layout. Basically I'm doing : if restricted build adminMenu else build userMenu Any ideas on how to achieve this ? olivvv Langdon Stevenson wrote: Hi rombehI have the following code in the controllers that I want to protect:(note: extra $helpers and $components have been removed to simplify)class LeadersController extends AppController { var $name = 'Leaders'; //for php4 var $helpers = array('othAuth'); var $components = array('othAuth'); var $othAuthRestrictions = array('index'); function beforeFilter() { $auth_conf = array('auto_redirect' = true, 'login_page' = 'leaders/login', 'logout_page' = 'leaders/logout', 'access_page' = '/leaders', 'hashkey' = 'mYpERsOnALhaSHkeY', 'strict_gid_check' = false); $this-othAuth-controller = $this; $this-othAuth-init($auth_conf); $this-othAuth-check(); } function index () { // Action code ... }}That is all that is required to add to the controller to protect the index action, assuming that you have followed the othAuth setup instructions and have the required classes and DB tables in place. As mentioned in my previous post I also have a permission in the permission table like this:INSERT INTO `cake_permissions` VALUES (1,'leaders/index','2006-03-13 23:19:31','-00-00 00:00:00'); And a Groups-Permissions mapping that
Re: Implemented OthAuth
Olivier,I have a question about you app_controller.php.If I understand it right, seeing where you have the beforeFilter set in the main controller, where you set the login to categories/login and the redirect to categories/login does that mean all the other controllers that do not override this will be redirected to categories/login if it is a restricted page? How do I set up a generic beforeFilter so that it can be handed in apage to redirect after the login is sucessful?Thanx.On 6/30/06, Ryan Petrain [EMAIL PROTECTED] wrote:Olivier, I am not getting that error, but when I visit a restricted page it redirects me to the login (good), I login with proper credentials, and then it redirects me to the login again.Any ideas on what I am still doing wrong? thanx for all your help so far.On 6/30/06, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: Ryan, I think you need a before filter, I have this : function beforeFilter() { $auth_conf = array( 'auto_redirect' = true, 'login_page' = 'categories/login', 'logout_page' = 'categories/view', 'access_page' = 'categories/login', 'hashkey' = 'MySEcEeTHaSHKeYz'); $this-othAuth-controller = $this; $this-othAuth-init($auth_conf); $this-othAuth-check(); } Sorry I'm in hurry got to go see Germany win. I'll look at your code later if I can. If you want you can have a look at how I implemented it in chameleon in cakeforge (take the svn, the package is old and broke) Ryan Petrain wrote: Hi Olivier, This is the user controller that handles the login. What other code do you need? class UsersController extends AppController { var $name = Users; var $components = array('othAuth'); //var $othAuthRestrictions = array('index','view'); var $othAuthRestrictions = null; var $uses = array('User'); function login() { $this-layout = 'nosearchbar'; if(isset($this-params['data'])) { //$this-flash(print_r($this-params['data']),'/users/login'); $auth_num = $this-othAuth-login($this-params['data']['User']); $this-set('auth_msg', $this-othAuth-getMsg($auth_num)); } } function logout() { $this-othAuth-logout(); $this-flash('You are not logged in!','/users/login'); } } ? On 6/30/06, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: can you paste your code ? (in cakebin for instance) Ryan Petrain wrote: Hi Langdon, Cna you help me get past a raher mundane aspect of using othAuth? I have added othAuth to my cake install and all appears to be fine. I try to get to a restricted area and it redirects to the login page. I enter the login credentials and then I get this error once I click the submit button: Notice: Trying to get property of non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php on line 109 Fatal error: Call to a member function find() on a non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php on line 109 The login page has access to the User object. I have even added the $users = array('User'); to the controller to see if that was what it needed but I still can not get past this. Any help would be appreciated. thanx. On 6/30/06, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: Wow. I see that there is more and more othAuth users. I've two issues I'm not sure how to tackle. Just wanna to know if some peoples are sharing the same concerns (and if crazylegs thought about that for the new version) 1.Sometimes I hit the login page while its seems that I am already logged. if I fill in the right login, then I got back the message that credentials are wrong. But n fact after that if I enter manually the url of a restricted method, I can access it. I'm not sure how to reproduce this but it happened often during testing of code in restricted method. maybe it is related to my use of requestAction. 2. I'd like to gather the name of all the controller having restricted methods, and the names of the restricted methods ($othAuthRestrictions) in my layout. Basically I'm doing : if restricted build adminMenu else build userMenu Any ideas on how to achieve this ? olivvv Langdon Stevenson wrote: Hi rombehI have the following code in the controllers that I want to protect:(note: extra $helpers and $components have been removed to simplify)class LeadersController extends AppController { var $name = 'Leaders'; //for php4 var $helpers = array('othAuth'); var $components = array('othAuth'); var $othAuthRestrictions = array('index'); function beforeFilter() { $auth_conf = array('auto_redirect' = true, 'login_page' = 'leaders/login', 'logout_page' = 'leaders/logout', 'access_page' = '/leaders', 'hashkey' = 'mYpERsOnALhaSHkeY', 'strict_gid_check' = false); $this-othAuth-controller = $this;
Re: Implemented OthAuth
I am looking to control where the person is being redirected to after they login based on what they were trying to access.I solved this problem by setting a variable $AuthConf = array(...) in app_controller.php and then having the other controllers override that to set the array to values needed for that controller. I cannot figure out why I am being redirected back to the login page again after Iogin.the pathe before login looks like:http://localhost/users/loginwhen redirected back to the login page it is: http://localhost/users/login/loginAny ideas?On 6/30/06, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: does that mean all the other controllers that do not override this will be redirected to categories/login if it is a restricted page? Yes, I think so, so how my app is behaving. For instance if I request posts/index/127 I'm redirected first to categories/login. I'm not sure if I understand you second question. You want to be always redirect to the same page after login, whatever the restricted page that has been called ? Ryan Petrain wrote: Olivier, I have a question about you app_controller.php. If I understand it right, seeing where you have the beforeFilter set in the main controller, where you set the login to categories/login and the redirect to categories/login does that mean all the other controllers that do not override this will be redirected to categories/login if it is a restricted page? How do I set up a generic beforeFilter so that it can be handed in apage to redirect after the login is sucessful? Thanx. On 6/30/06, Ryan Petrain [EMAIL PROTECTED] wrote: Olivier, I am not getting that error, but when I visit a restricted page it redirects me to the login (good), I login with proper credentials, and then it redirects me to the login again. Any ideas on what I am still doing wrong? thanx for all your help so far. On 6/30/06, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: Ryan, I think you need a before filter, I have this : function beforeFilter() { $auth_conf = array( 'auto_redirect' = true, 'login_page' = 'categories/login', 'logout_page' = 'categories/view', 'access_page' = 'categories/login', 'hashkey' = 'MySEcEeTHaSHKeYz'); $this-othAuth-controller = $this; $this-othAuth-init($auth_conf); $this-othAuth-check(); } Sorry I'm in hurry got to go see Germany win. I'll look at your code later if I can. If you want you can have a look at how I implemented it in chameleon in cakeforge (take the svn, the package is old and broke) Ryan Petrain wrote: Hi Olivier, This is the user controller that handles the login. What other code do you need? class UsersController extends AppController { var $name = Users; var $components = array('othAuth'); //var $othAuthRestrictions = array('index','view'); var $othAuthRestrictions = null; var $uses = array('User'); function login() { $this-layout = 'nosearchbar'; if(isset($this-params['data'])) { //$this-flash(print_r($this-params['data']),'/users/login'); $auth_num = $this-othAuth-login($this-params['data']['User']); $this-set('auth_msg', $this-othAuth-getMsg($auth_num)); } } function logout() { $this-othAuth-logout(); $this-flash('You are not logged in!','/users/login'); } } ? On 6/30/06, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: can you paste your code ? (in cakebin for instance) Ryan Petrain wrote: Hi Langdon, Cna you help me get past a raher mundane aspect of using othAuth? I have added othAuth to my cake install and all appears to be fine. I try to get to a restricted area and it redirects to the login page. I enter the login credentials and then I get this error once I click the submit button: Notice: Trying to get property of non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php on line 109 Fatal error: Call to a member function find() on a non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php on line 109 The login page has access to the User object. I have even added the $users = array('User'); to the controller to see if that was what it needed but I still can not get past this. Any help would be appreciated. thanx. On 6/30/06, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: Wow. I see that there is more and more othAuth users. I've two issues I'm not sure how to tackle. Just wanna to know if some peoples are sharing the same concerns (and if crazylegs thought about that for the new version) 1.Sometimes
Re: Implemented OthAuth
Well, I experience unwanted redirects to the login page also. But I can't tell what are the conditions for this bug to happen. Sorry, I can't imagine why in addition to that you've twice the login param. Ryan Petrain wrote: I am looking to control where the person is being redirected to after they login based on what they were trying to access. I solved this problem by setting a variable $AuthConf = array(...) in app_controller.php and then having the other controllers override that to set the array to values needed for that controller. I cannot figure out why I am being redirected back to the login page again after Iogin. the pathe before login looks like: http://localhost/users/login when redirected back to the login page it is: http://localhost/users/login/login Any ideas? On 6/30/06, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: "does that mean all the other controllers that do not override this will be redirected to "categories/login" if it is a restricted page?" Yes, I think so, so how my app is behaving. For instance if I request "posts/index/127" I'm redirected first to categories/login. I'm not sure if I understand you second question. You want to be always redirect to the same page after login, whatever the restricted page that has been called ? Ryan Petrain wrote: Olivier, I have a question about you app_controller.php. If I understand it right, seeing where you have the beforeFilter set in the main controller, where you set the login to "categories/login" and the redirect to "categories/login" does that mean all the other controllers that do not override this will be redirected to "categories/login" if it is a restricted page? How do I set up a generic beforeFilter so that it can be handed in apage to redirect after the login is sucessful? Thanx. On 6/30/06, Ryan Petrain [EMAIL PROTECTED] wrote: Olivier, I am not getting that error, but when I visit a restricted page it redirects me to the login (good), I login with proper credentials, and then it redirects me to the login again. Any ideas on what I am still doing wrong? thanx for all your help so far. On 6/30/06, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: Ryan, I think you need a before filter, I have this : function beforeFilter() { $auth_conf = array( 'auto_redirect' = true, 'login_page' = 'categories/login', 'logout_page' = 'categories/view', 'access_page' = 'categories/login', 'hashkey' = 'MySEcEeTHaSHKeYz'); $this-othAuth-controller = $this; $this-othAuth-init($auth_conf); $this-othAuth-check(); } Sorry I'm in hurry got to go see Germany win. I'll look at your code later if I can. If you want you can have a look at how I implemented it in chameleon in cakeforge (take the svn, the package is old and broke) Ryan Petrain wrote: Hi Olivier, This is the user controller that handles the login. What other code do you need? class UsersController extends AppController { var $name = "Users"; var $components = array('othAuth'); //var $othAuthRestrictions = array('index','view'); var $othAuthRestrictions = null; var $uses = array('User'); function login() { $this-layout = 'nosearchbar'; if(isset($this-params['data'])) { //$this-flash(print_r($this-params['data']),'/users/login'); $auth_num = $this-othAuth-login($this-params['data']['User']); $this-set('auth_msg', $this-othAuth-getMsg($auth_num)); } } function logout() { $this-othAuth-logout(); $this-flash('You are not logged in!','/users/login'); } } ? On 6/30/06, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: can you paste your code ? (in cakebin for instance) Ryan Petrain wrote: Hi Langdon, Cna you help me get past a raher mundane aspect of using othAuth? I have added othAuth to my cake install and all appears to be fine. I try to get to a restricted area and it redirects to the login page. I enter the login credentials and then I get this error once I click the submit button: Notice: Trying to get property of non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php on line 109 Fatal error: Call to a member function find() on a non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php on line 109 The login page has access to the User object. I have even added the $users = array('User'); to the controller to see if that was what
Re: Implemented OthAuth
Hi Olivier and Ryan I have experienced all of the problems that you are now seeing. 1. Constant redirecting to login page indicates that the Permissions and var $othAuthRestrictions are not set up right. I was not able to get * to work to protect all actions. I didn't take the time to figure out why, as I didn't really need it. 2. When I set up the login code in my Users controller I got errors like this: Notice: Trying to get property of non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php on line 109 Fatal error: Call to a member function find() on a non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php on line 109 I moved the login code to another controller and it worked fine. No idea why. 3. You must have the beforeFilter initialise othAuth, particularly $othAuthRestrictions. I haven't dug around in the othAuth code enough to be able to really understand all of its logic, so sorry if this post doesn't provide enough info. Regards, Langdon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Implemented OthAuth
Hi Alberto You lucky... I got a lot of problems because when I tried to implement othAuth, it didnt' work...basically because I could only use the admin user and not the oth one...and also I didn't understand the permissions...maybe you think you can help? It took me a while to get my head around how to properly set the permissions in the controller and the permissions table. Once I had it right though, I was away and it worked fine. The trick for me was: LeadersController: var $othAuthRestrictions = array('index'); Permissions table in DB: Name: leaders/index This arrangement (along with the appropriate group mapping for the user) protects the index action of the leader controller. Hope that is useful to you. Feel free to post some code and DB values here if you like. I would be happy to look at them for you. Regards, Langdon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---