Is session variable a good place to store authorization info?

2012-05-12 Thread bs28723
I created a Auth component to do some special authorization checking.
The Auth component gets called first before any controller isAuthorized 
routines.
   I was thinking about saving some permissions in a session variable 
inside the Auth component.
Then the controller could get this detail and perform additional checks 
on access to record or field level data.
I could also have access to this data in the Views to help with 
displaying different data.

Does this make sense?  Is this a good idea?  Is there a better way?


--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/Is-session-variable-a-good-place-to-store-authorization-info-tp5707857.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
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: Recover associated data of second level.

2012-05-12 Thread Tony Messias
What about the "recursive" param on your params array?

http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#find

i.e:
$this->User->find('all', array('recursive' => 2));

--

Luiz Antonio S Messias
Desenvolvedor Web


@tonyzrp 
*LinkedIn* 



2012/5/12 J. 

> To Be more precise I have :
>
> User hasOne Profile
> Profile belongsTo USer
>
> Profile HABTM Card
> Card HABTM Profile
>
> Since profile belongs to User, How can I get its associated data (CArd)
> from the USer view ?
>
>
>
> Le samedi 12 mai 2012 16:25:48 UTC+2, J. a écrit :
>
>> Hi,
>>
>> In my cake app I have :
>>
>> User hasOne Profile HasAndBelongsToMany Card
>>
>> When I find a user, I get this array :
>>
>> array(
>>> 'User' => array(
>>> 'password' => '*',
>>> 'id' => '1',
>>> 'email' => '***',
>>> 'username' => '**',
>>> ),
>>> 'Profile' => array(
>>> 'id' => '1',
>>> 'user_id' => '1',
>>> 'background' => 'galaxy.png',
>>> 'modified' => '2012-05-12 15:09:59'
>>> )
>>> )
>>>
>>>
>> When I find a profile I got this array :
>>
>> array(
>>  'Profile' => array(
>>  'id' => '1',
>>  'user_id' => '1',
>>  'background' => 'http://pierrebozon.com/**galaxy.png 
>> ',
>>  'modified' => '2012-05-12 15:09:59'
>>  ),
>>  'User' => array(
>>  'password' => '*',
>>  'id' => '1',
>>  'username' => '*',
>>  'created' => '2012-05-08 00:00:00'
>>  ),
>>  'Card' => array(
>>  (int) 0 => array(
>>  'id' => '1',
>>  'label' => '',
>>  'LicensesProfile' => array(
>>  'id' => '1',
>>  'profile_id' => '1',
>>  'Card_id' => '1'
>>  )
>>  )
>>  )
>>
>>
>>
>>> )
>>
>>
>>
>> How can I get Card info from the User view ? I mean something like this :
>>
>>  array(
>>
>>
>>  'User' => array(
>>  'password' => '*',
>>  'id' => '1',
>>  'email' => '***',
>>  'username' => '**',
>>  ),
>>  'Profile' => array(
>>  'id' => '1',
>>  'user_id' => '1',
>>  'background' => 'galaxy.png',
>>  'modified' => '2012-05-12 15:09:59'
>>  'Card' => array(
>>
>>
>>  'id' => '1 ' etc
>>
>>
>>  )
>>
>>
>>   )
>> )
>>
>>
>> Thanks a lot !
>>
>>  --
> 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
>

-- 
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-12 Thread John Hardy
IMO with a cluttered schema i would rely on stored procedures for the
abstraction and keep the code complexity at a minimum
On May 11, 2012 11:54 PM, "rihad"  wrote:

> 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
>

-- 
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: Is there a way to test if "on localhost" ?

2012-05-12 Thread John Hardy
Use the uname method to test the machines name

Http://php.net/php_uname
On May 12, 2012 11:27 AM, "Daniel"  wrote:

> Hi,
>
> I want to write some code along the lines of:
> if ("on localhost")
>// site is being tested: do something
> else
>// site is live: do something else
>
> ... or is there another way to do this?
>
> 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
>

-- 
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: Is there a way to test if "on localhost" ?

2012-05-12 Thread Christopher Castro
You can try something like this:

if (in_array(env('HTTP_HOST'), array('localhost', '127.0.0.1'))) {
// localhost
} else {
// live
}

2012/5/12 Daniel 

> Hi,
>
> I want to write some code along the lines of:
> if ("on localhost")
>// site is being tested: do something
> else
>// site is live: do something else
>
> ... or is there another way to do this?
>
> 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
>



-- 
Christopher Castro.
Analista Programador Senior PHP/MySQL
Pamplona, España
QuickApps.es 
https://github.com/quickapps/QuickApps-CMS/

-- 
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


Is there a way to test if "on localhost" ?

2012-05-12 Thread Daniel
Hi,

I want to write some code along the lines of:
if ("on localhost")
// site is being tested: do something
else
// site is live: do something else

... or is there another way to do this?

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: Recover associated data of second level.

2012-05-12 Thread J.
To Be more precise I have :

User hasOne Profile
Profile belongsTo USer

Profile HABTM Card
Card HABTM Profile

Since profile belongs to User, How can I get its associated data (CArd) 
from the USer view ?



Le samedi 12 mai 2012 16:25:48 UTC+2, J. a écrit :
>
> Hi,
>
> In my cake app I have :
>
> User hasOne Profile HasAndBelongsToMany Card
>
> When I find a user, I get this array :
>
> array(
>>  'User' => array(
>>  'password' => '*',
>>  'id' => '1',
>>  'email' => '***',
>>  'username' => '**',
>>  ),
>>  'Profile' => array(
>>  'id' => '1',
>>  'user_id' => '1',
>>  'background' => 'galaxy.png',
>>  'modified' => '2012-05-12 15:09:59'
>>  )
>> )
>>
>>
> When I find a profile I got this array :
>
> array(
>   'Profile' => array(
>   'id' => '1',
>   'user_id' => '1',
>   'background' => 'http://pierrebozon.com/galaxy.png',
>   'modified' => '2012-05-12 15:09:59'
>   ),
>   'User' => array(
>   'password' => '*',
>   'id' => '1',
>   'username' => '*',
>   'created' => '2012-05-08 00:00:00'
>   ),
>   'Card' => array(
>   (int) 0 => array(
>   'id' => '1',
>   'label' => '',
>   'LicensesProfile' => array(
>   'id' => '1',
>   'profile_id' => '1',
>   'Card_id' => '1'
>   )
>   )
>   ) 
>
>  
>
>> ) 
>
>
>
> How can I get Card info from the User view ? I mean something like this :
>
>  array(
>
>   'User' => array(
>   'password' => '*',
>   'id' => '1',
>   'email' => '***',
>   'username' => '**',
>   ),
>   'Profile' => array(
>   'id' => '1',
>   'user_id' => '1',
>   'background' => 'galaxy.png',
>   'modified' => '2012-05-12 15:09:59'
>   'Card' => array(
>
>  'id' => '1 ' etc
>
>  )
>
>   )
> )
>
> Thanks a lot !
>
>

-- 
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


Model Behavior and filtering results in a DboSource class Options

2012-05-12 Thread kirill_z
I've noticed that _queryAssociation method, within DboSource class,
calls
linked models afterFind callback, but does not calls linked models
behavior callbacks.
IMHO, it can be potential risk when you protect some model with
AclBehavior. Because, Model->find() method returns associated model
data
disregarding permissions of the last.

-- 
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


Recover associated data of second level.

2012-05-12 Thread J.
Hi,

In my cake app I have :

User hasOne Profile HasAndBelongsToMany Card

When I find a user, I get this array :

array(
>   'User' => array(
>   'password' => '*',
>   'id' => '1',
>   'email' => '***',
>   'username' => '**',
>   ),
>   'Profile' => array(
>   'id' => '1',
>   'user_id' => '1',
>   'background' => 'galaxy.png',
>   'modified' => '2012-05-12 15:09:59'
>   )
> )
>
>
When I find a profile I got this array :

array(
'Profile' => array(
'id' => '1',
'user_id' => '1',
'background' => 'http://pierrebozon.com/galaxy.png',
'modified' => '2012-05-12 15:09:59'
),
'User' => array(
'password' => '*',
'id' => '1',
'username' => '*',
'created' => '2012-05-08 00:00:00'
),
'Card' => array(
(int) 0 => array(
'id' => '1',
'label' => '',
'LicensesProfile' => array(
'id' => '1',
'profile_id' => '1',
'Card_id' => '1'
)
)
) 

 

> ) 



How can I get Card info from the User view ? I mean something like this :

 array(

'User' => array(
'password' => '*',
'id' => '1',
'email' => '***',
'username' => '**',
),
'Profile' => array(
'id' => '1',
'user_id' => '1',
'background' => 'galaxy.png',
'modified' => '2012-05-12 15:09:59'
'Card' => array(

 'id' => '1 ' etc

 )

  )
)

Thanks a lot !

-- 
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: Bake in Cakephp 2.0 give me a code of previus version?!!

2012-05-12 Thread gabrielem
now I found a different problem :)

The code generated by bake is now of cakephp 2.0 version

But it not work... I have only a blank page, and if i write something in 
the app controller or every where 

i have only blank page and blank html...





Il giorno sabato 12 maggio 2012 09:29:40 UTC+2, gabrielem ha scritto:
>
> I solved! Thank You Justin
> it was /usr/bin/cake
>
> it was looking for a wrong path! Now i change the path on the cake file
>
> #LIB=/usr/share/php/cake/console/
> LIB=/usr/share/php/cakephp/app/Console/
>
>
>
>
>
>
> Il giorno venerdì 11 maggio 2012 11:02:01 UTC+2, Justin Edwards ha scritto:
>>
>> Enter the command "which cake"
>> On May 11, 2012 1:53 AM, "gabrielem"  wrote:
>>
>>> @José Lorenzo and How to this?
>>>
>>> @cricket the path is correct! I have specified the path of console in a 
>>> cakephp 2.0 
>>>
>>> Il giorno giovedì 10 maggio 2012 03:16:18 UTC+2, cricket ha scritto:

 Make sure your PATH is updated (eg. in ~/.bashrc) or call the 2.0 
 version with the entire path: /path/to/lib/Cake/Console/cake 

 On Tue, May 8, 2012 at 5:46 PM, José Lorenzo  
 wrote: 
 > Obviously because you have executed the 'cake' command for a previous 
 > version, make sure you call the shell for 2.0 instead 
 > 
 > 
 > On Tuesday, May 8, 2012 1:09:24 PM UTC-4:30, gabrielem wrote: 
 >> 
 >> I have downloaded cakephp 2.0 
 >> I'm learning cakephp, and try to bake model, controller and views... 
 >> I have bake a project to.. 
 >> 
 >> But then I have see that the code generated by the bake script is 
 >> following previulsy convention... 
 >> 
 >> The app_controller file is located in  the main directory and is not 
 in 
 >> the Controllers directory... 
 >> all the file for controller have the name: nome_controller.php but 
 in 
 >> cakephp 2.0 must be NameController.php... 
 >> 
 >> wy? 
 >> 
 >> Before of this i did not download previous version of cakephp... 
 >> 
 >> 
 >> 
 > -- 
 > 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+unsubscribe@**googlegroups.comFor
 >  more options, visit this group at 
 > http://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
>>>
>>

-- 
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: Bake in Cakephp 2.0 give me a code of previus version?!!

2012-05-12 Thread gabrielem
I solved! Thank You Justin
it was /usr/bin/cake

it was looking for a wrong path! Now i change the path on the cake file

#LIB=/usr/share/php/cake/console/
LIB=/usr/share/php/cakephp/app/Console/






Il giorno venerdì 11 maggio 2012 11:02:01 UTC+2, Justin Edwards ha scritto:
>
> Enter the command "which cake"
> On May 11, 2012 1:53 AM, "gabrielem"  wrote:
>
>> @José Lorenzo and How to this?
>>
>> @cricket the path is correct! I have specified the path of console in a 
>> cakephp 2.0 
>>
>> Il giorno giovedì 10 maggio 2012 03:16:18 UTC+2, cricket ha scritto:
>>>
>>> Make sure your PATH is updated (eg. in ~/.bashrc) or call the 2.0 
>>> version with the entire path: /path/to/lib/Cake/Console/cake 
>>>
>>> On Tue, May 8, 2012 at 5:46 PM, José Lorenzo  
>>> wrote: 
>>> > Obviously because you have executed the 'cake' command for a previous 
>>> > version, make sure you call the shell for 2.0 instead 
>>> > 
>>> > 
>>> > On Tuesday, May 8, 2012 1:09:24 PM UTC-4:30, gabrielem wrote: 
>>> >> 
>>> >> I have downloaded cakephp 2.0 
>>> >> I'm learning cakephp, and try to bake model, controller and views... 
>>> >> I have bake a project to.. 
>>> >> 
>>> >> But then I have see that the code generated by the bake script is 
>>> >> following previulsy convention... 
>>> >> 
>>> >> The app_controller file is located in  the main directory and is not 
>>> in 
>>> >> the Controllers directory... 
>>> >> all the file for controller have the name: nome_controller.php but in 
>>> >> cakephp 2.0 must be NameController.php... 
>>> >> 
>>> >> wy? 
>>> >> 
>>> >> Before of this i did not download previous version of cakephp... 
>>> >> 
>>> >> 
>>> >> 
>>> > -- 
>>> > 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+unsubscribe@**googlegroups.comFor
>>> >  more options, visit this group at 
>>> > http://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
>>
>

-- 
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