Re: more than 1 level of belongsTo

2012-06-08 Thread rihad


On Jun 8, 9:20 pm, simo ahalshaba  wrote:
> change recurssive to 2 and test
>
>
Already tried that. No effect.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


more than 1 level of belongsTo

2012-06-08 Thread rihad
Hi, I have a model Foo belongsTo Bar, which in turn belongsTo Xyzzy.
When I do $this->Foo->find('all');

sql dump shows that the SQL join is performed only for Foo->Bar, but
Xyzzy is never mentioned.
I tried all sorts of 'recursive' => 1 it didn't matter.
Please help me.

CakePHP 1.3.15

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Unauthorized users don't get redirected to login action

2012-05-27 Thread rihad
> Trying to access an unauthorized area of the app should not log them out by
> default and kick them to a log in page.

There's absolutely no need to log them out first. Redirecting to index
page is weird, the user never asked for it. But they did ask for the
resource they had no right to access, so presenting them with a login
screen gets them closer to what they really wanted. Does it make any
sense now?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Unauthorized users don't get redirected to login action

2012-05-26 Thread rihad


On May 25, 7:13 pm, Dave Milsom  wrote:
> On Friday, May 25, 2012 2:15:51 AM UTC-4, rahajiyev wrote:
>
> > On May 24, 6:52 pm, Ceeram  wrote:
> > > Why should a logged in user be redirected to login?
>
> > The logged in user doesn't have that specific privilege.
> > One would expect a login screen to appear when one has insufficient
> > privileges...
>
> I wouldn't expect that.

Well, you would expect to be told that you don't have the permission,
and be allowed to log in as the user who does have it, wouldn't you?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Oracle

2012-05-22 Thread rihad


On May 22, 11:58 am, oDiN  wrote:
> I dont have problems with the prefix table .. :)
>
When you connect as the owner of the database, you don't need to use
the prefix. But when you grant selective access to another user, he
generally needs to say schema_name.table_name.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Oracle

2012-05-22 Thread rihad
Have you been able to use any conditionals in your find() calls?
I can't use even the simplest ones. See this thread:
http://groups.google.com/group/cake-php/browse_thread/thread/234f4a33b862d79a#

On May 22, 4:31 pm, oDiN  wrote:
> I have update the blog post. Check the latest code at Bitbucket. Also the
> stored procedure works fine too in CakePHP 2.1.2
>
>
>
>
>
>
>
> On Monday, 21 May 2012 20:46:46 UTC+8, rahajiyev wrote:
>
> > OMG, I just succeeded in getting paginator to work properly, with
> > sorting and all that! Apart from what was said in the tutorial above,
> > I also needed to tweak function describe() in Oracle.php.
>
> > The line where it says
> >  $sql = 'SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH FROM
> > all_tab_columns WHERE table_name = \'';
>
> > Changed
> > $sql .= strtoupper($this->fullTableName($model)) . '\'';
> > to
> > $sql .= strtoupper($model->useTable) . '\'';
>
> > Because WHERE table_name=prefix.my_table_name returns 0 results as
> > compared to my_table_name with no prefix part.
> > So far so good. If only I could get simple updates to work, life would
> > be beautiful :) Haven't tried that yet.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Many-to-many ACL

2012-05-21 Thread rihad
Nevermind, I think I got Oracle working with 2.1 thanks to this
tutorial and a bit more thumb twiddling:
http://www.hassanbakar.com/2012/01/09/using-oracle-in-cakephp-2-0/comment-page-1/#comment-38958

At the very least I could get pagination working.

On May 21, 5:35 pm, rahajiyev  wrote:
> On May 16, 1:23 am, Justin Edwards  wrote:
>
> > To DB
>
> >https://github.com/justinledwards/tinyauthdb/blob/2.1/app/Controller/...
>
> Does tinyauthdb work with Cake 1.3? I need 1.3 for its Oracle support.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Comparing user's existing password

2012-05-18 Thread rihad
I should note that users are able to log in by entering their user/
pass, thus hashing works. It's just that I'm unable to generate the
same hash using AuthComponent::password('my-cleartext-pass')

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Comparing user's existing password

2012-05-18 Thread rihad
No, of course I didn't. Only one thing changed, don't know if it's
related: I entered the users and their hashed passwords in one
controller, then logged in as them and attempted hashing their own
password in the other. This shouldn't matter, unless Cake further
salts the hash using controller's name or something.


On May 18, 6:32 pm, Michael Gaiser  wrote:
> Have you changed your security salt setting since you first entered in
> original password? If so your passwords hash will not match.
>
> Sent from my iPhone
>
> On 2012-05-18, at 8:49 AM, rahajiyev  wrote:
>
>
>
>
>
>
>
> > When user enters his current password for verification it compares
> > unequal to his real password.
>
> > Here's my custom validation rule function:
>
> >        public function check_current_password($current_password) {
> >                $user = $this->find('first', array('id' => $this-
> >> id));
> >                debug(AuthComponent::password($current_password));
> > debug($user[$this->alias]['password']); exit;
> >                return AuthComponent::password($current_password) ==
> > $user[$this->alias]['password'];
> >        }
>
> > after I click submit:
> > /app/Model/Milli.php (line 40)
>
> > '6cff21416995c69a93338d57f969665dc2bb2e00'
>
> > /app/Model/Milli.php (line 40)
>
> > 'fc33ed920738abf172f2b56f6afbda65e86525de'
>
> > The latter is correct, as stored in the database. What's going on?! I
> > stored the password using same AuthComponent::password() call.
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Many-to-many ACL

2012-05-17 Thread rihad
I've tried copying auth stuff to User, and modified routes
accordingly, it didn't help.
User is a prefixed (/admin) controller for creating operators that
will be using the app based on their roles in non-prefixed URLs.
The authentication of /admin itself happens in Apache. The creator of
operators through CRUD doesn't need to use the app itself.

On May 17, 7:34 pm, Justin Edwards  wrote:
> I've never tried to make the User model be named anything else.  I have
> users and roles many to many on both sides though.
>
> https://github.com/justinledwards/tinyauthdb/tree/2.1/app/Model
>
> https://github.com/justinledwards/tinyauthdb/blob/2.1/app/Model/Role.phphttps://github.com/justinledwards/tinyauthdb/blob/2.1/app/Model/User.php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Many-to-many ACL

2012-05-17 Thread rihad


On May 17, 7:34 pm, Justin Edwards  wrote:
> I've never tried to make the User model be named anything else.  I have
> users and roles many to many on both sides though.
>
> https://github.com/justinledwards/tinyauthdb/tree/2.1/app/Model
>
> https://github.com/justinledwards/tinyauthdb/blob/2.1/app/Model/Role.phphttps://github.com/justinledwards/tinyauthdb/blob/2.1/app/Model/User.php
>

Thanks. Mark said that too small "recursive" might be an issue,
although its default setting of 1 should be enough to reach the roles.
This looks like the most probable reason because
TinyAuthorize::authorize() receives plain $user with no joins. I'll
check that tomorrow. I'll also try adding the other side of HABTM to
Role.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Many-to-many ACL

2012-05-16 Thread rihad
On May 16, 1:23 am, Justin Edwards  wrote:
> http://www.dereuromark.de/2011/12/18/tinyauth-the-fastest-and-easiest...
>
> To DB
>
> https://github.com/justinledwards/tinyauthdb/blob/2.1/app/Controller/...
>
>
I'm having a hard time choosing the right place for this code. Where
do I put it cleanly? I tried dropping it off in Plugin/ but Cake won't
find it.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Many-to-many ACL

2012-05-15 Thread rihad
Hi. I need users to belong to more than one role. Like "Can-do-this",
"Can-do-that", etc. I think a many-to-many relationship fits this
need. Like this (in pseudo-sql)

table users:
id int primary key;
name varchar;

table roles:
id int primary key;
name varchar;

table roles_users:
id int primary key;
user_id foreign key users(id);
role_id foreign key roles(id);

So each user can have multiple roles listed in roles_users. I looked
at the ACL tutorial:
http://book.cakephp.org/2.0/en/tutorials-and-examples/simple-acl-controlled-application/simple-acl-controlled-application.html
but it only makes use of a single group_id. Cake's Auth subsystem
looks fine to me. Can I use it with multiple roles described above?
Thanks.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: optional routing elements

2012-05-14 Thread rihad
Isn't this a bug?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


optional routing elements

2012-05-13 Thread rihad
Hi, I'm reading the routing docs here: 
http://book.cakephp.org/2.0/en/development/routing.html
Basically what it says is that the following route config:

Router::connect('/foo/bar/:year/:month/:day', array('controller' =>
'foo', 'action' => 'bar', 'day' => null));

would treat the last element as optional, and would therefore also
match this URL:

/foo/bar/1/2

yet it doesn't. It does match /foo/bar/1/2/3

CakePHP 2.1.2

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Using Oracle

2012-05-11 Thread rihad
Most tables in our Oracle database are huge with tens of columns, have
no single-column primary keys, or have multi-column keys. Can CakePHP
2.1 make sense of it all?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Using Oracle

2012-05-11 Thread rihad
Thanks, stork. I've followed this little guide:
http://www.hassanbakar.com/2012/01/09/using-oracle-in-cakephp-2-0/comment-page-1/#comment-38958
and could successfully migrate dbo_oracle.php from 1.3.15 to 2.1,
allowing Cake's index.php to pass all its preliminary tests. Is it a
bit early to be singing my praises? I'll be using nothing fancy, plain
multi-table selects, simple updates, no deletes or inserts.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Using Oracle

2012-05-10 Thread rihad
Hi, folks. Can I use CakePHP 2.1.2 with Oracle database? I looked in
Model/Datasource/Database/ there only seems to be support for Mysql,
Postgres, Sqlite, Sqlserver. But working with an existing Oracle
database is my job's requirement. I would be thankful for any tips.
Thank you.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php