Quantcast

hide model fields from controller

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

hide model fields from controller

Mahmoud Adel Farid
i want any controller not to be able to access(read or write) a certain field in the model
how can i accomplish that

--
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
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: hide model fields from controller

euromark (munich)
it is usually not the controller you need to worry about

in the view level just dont output the variable
and on input (forms etc) use whitelisting for the model methods to exclude the field on save etc.



Am Montag, 30. Juli 2012 16:34:59 UTC+2 schrieb Mahmoud Adel Farid:
i want any controller not to be able to access(read or write) a certain field in the model
how can i accomplish that

--
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
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: hide model fields from controller

Mahmoud Adel Farid
well i am worried about controller so no other team member can directly change some fields , i need to encapsulate some fields

--
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
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: hide model fields from controller

euromark (munich)
if you can't trust your co-workers, you might want to change the company.
PS: they could still go into the database directly to alter values (or do you also cipher the database.php?)

in any case the above hints should get you started on how to address the problem.


Am Mittwoch, 1. August 2012 10:37:29 UTC+2 schrieb Mahmoud Adel Farid:
well i am worried about controller so no other team member can directly change some fields , i need to encapsulate some fields

--
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
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: hide model fields from controller

CRAZy-2-2
In reply to this post by Mahmoud Adel Farid
You can use the model callbacks for that, the beforesave one, see:


On Wednesday, August 1, 2012 10:37:29 AM UTC+2, Mahmoud Adel Farid wrote:
well i am worried about controller so no other team member can directly change some fields , i need to encapsulate some fields

--
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
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: hide model fields from controller

euromark (munich)
it boils down to either
- use security component (form fields cannot be messed with)


Am Mittwoch, 1. August 2012 11:09:21 UTC+2 schrieb Crazy:
You can use the model callbacks for that, the beforesave one, see:


On Wednesday, August 1, 2012 10:37:29 AM UTC+2, Mahmoud Adel Farid wrote:
well i am worried about controller so no other team member can directly change some fields , i need to encapsulate some fields

--
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
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: hide model fields from controller

Mahmoud Adel Farid
In reply to this post by euromark (munich)
@euromarks & @Crazy
thanks

@euromarks 
it is not a trust issue it is matter of good programming practice
that is what encapsulation originally made for (correct me if i am wrong)

--
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
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Loading...