![]() |
Ion Auth - Lightweight Auth System based on Redux Auth 2 - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Ion Auth - Lightweight Auth System based on Redux Auth 2 (/showthread.php?tid=27435) Pages:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 02-11-2011 [eluser]c-s-n[/eluser] Hi there, I just wanted to give a bit of feedback to the great Ion Auth library. My Version is exactly one week old and downloaded from github. Codeigniter is v1.7.3 In your example controller you heavily use flashdata. So did i but in conjunction with database sessions. When I updated a user and got a duplicate error, the new session data could not be stored in the database, because the transaction was not completed and so the flashdata message stayed empty. So here is the fix: ion_auth_model.php Code: // After line 838, before return FALSE: Also I changed the english language file a bit - just writing style, not wanted to keep back from you ![]() Code: // Account Creation Regards Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 02-11-2011 [eluser]Ben Edmunds[/eluser] Thanks c-s-n. I created a GitHub issue for this and I'll look into this when I get a chance: http://github.com/benedmunds/CodeIgniter-Ion-Auth/issues/issue/44 Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 02-14-2011 [eluser]Basketcasesoftware[/eluser] Been sidetracked with other stuff this weekend, Ben. I'll be getting back to that DataMapper version as soon as I can get back on track. Kind of embarrassing really. :red: Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 02-16-2011 [eluser]c-s-n[/eluser] Ok, hi again. A bit too often now I looked at some database errors produced by Ion Auth. I'm using PostgreSQL DBMS and you know, this is very restrictive related to data types. I know one could/should check for correct types of variables passed to a function - but look at this example: Code: $this->ion_auth->get_user_by_identity( $this->session->userdata('my_user') ) And then your model tries to compare varchar with boolean... The same thing could happen in your model functions, where you also just rely on the correct session variable type. To avoid this you should check against the type first in the library, because if done in model and returned NULL, you get things like "Call to a member function row() on a non-object" from library So this is, what I did in the library to check the parameter (adapt for other functions): Code: public function get_user_by_identity($identity) { Then one can check with Code: is_object(($user = $this->ion_auth->get_user_by_identity( $this->session->userdata('my_user') ))) Best regards Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 02-18-2011 [eluser]c77m[/eluser] I made the conversion from Tank_auth to Ion_auth last night (which was surprisingly easy). So far I really enjoy this library, but I ran into a problem today that I can't track down. When loading any page now, I get the following PHP error: Message: Undefined property: Auth::$ion_auth, Filename: core/Model.php, Line Number: 50 It's related to the login session (I logged in last night and checked "Remember me"), but I don't know where to go to resolve it. I have the Ion_auth library in my autoload config, and if I delete the identity and remember_me cookies I can log in with everything being normal. The CI log for the page load: Code: DEBUG - 2011-02-18 13:52:49 --> Config Class Initialized EDIT: This seems to be the same error that was referenced in a post last year (http://ellislab.com/forums/viewreply/736434/). It seems to only happen when I have logged in via multiple browsers and the ci_session cookie has expired. (I set the Ion_auth cookie to expire after a week, but ci_session expires after two hours by default.) I haven't looked through the code in enough detail to verify the proposed fix is ideal, but I suspect I'll have to before rollout time. Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 02-18-2011 [eluser]Glazz[/eluser] @c77m - The fix: https://bitbucket.org/ellislab/codeigniter/issue/252/undefined-method-error-produced-when-using Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 02-19-2011 [eluser]fran-quero[/eluser] Hello. Congratullations for this great library. I´m new in CI and I´m testing Ion Auth in a test application. I´d like to set access based on groups. 1. I haven´t see that in the code. Is there any pre-made function or way to do it? 2. If there isn´t, please, check my code to know if I have done a good practice, or if there´s a better way to do it: I have added a function to ion_auth_model.php to control if the user´s group is allowed to acces and optionally if the user have made a payment (in my application there are free and payments users) ion_auth_model.php Code: public function access($allowed_group,$check_payment=false) When I want to set the access level to a controller I add: Code: $this->ion_auth->access(2,true);//Grant access to users from group 2 or higher who have paid I´m new in CI and in MVC, is that a good practice? Is there a better way to do this? Thanks for your advice. Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 02-19-2011 [eluser]c77m[/eluser] [quote author="Glazz" date="1298104586"]@c77m - The fix: https://bitbucket.org/ellislab/codeigniter/issue/252/undefined-method-error-produced-when-using[/quote] Glazz, thanks for the link. I'm very much opposed to hacking the CI core to hide a library bug, but this link will hopefully help me track down the offending code in the library when I have a few more minutes. Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 02-19-2011 [eluser]c77m[/eluser] [quote author="fran-quero" date="1298168229"]Hello. Congratullations for this great library. I´m new in CI and I´m testing Ion Auth in a test application. I´d like to set access based on groups. 1. I haven´t see that in the code. Is there any pre-made function or way to do it? [/quote] fran-quero, There is already a function, is_group(), that will check group membership for you. (http://benedmunds.com/ion_auth/#is_group) Quote: As written, this will always return true. ;-) Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 02-19-2011 [eluser]fran-quero[/eluser] [quote author="c77m" date="1298168683"] There is already a function, is_group(), that will check group membership for you. (http://benedmunds.com/ion_auth/#is_group) [/quote] Thanks! I should have read more :red: [quote author="c77m" date="1298168683"] Code: if($user=$this->ion_auth->get_user()) No if the user is not logged in. I use it to check it. Now I will combine logged_in() + is_group(). Thanks again! |