Docker and CakePHP?

2014-09-24 Thread OJ Tibi - @ojtibi
Howdy, folks. I was wondering if any of you have experience deploying 
CakePHP in Docker containers? Also, have you tried running CakePHP shells 
inside a Docker container and/or set up a shell as a cron job inside the 
container?

TIA,
OJ

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


CakePHP automagic ID lookup for various data

2014-09-24 Thread Paul Drage
Hello!

So this is really more of a general question, I'm hoping one day Google 
might pick it up for other Cake noobs like myself.

I'm sure I am missing something really simple here:
CakePHP cake bake all generates some scaffolding / CRUD views which work 
really well.

The behaviour I'm finding hard to replicate at the moment is when Cake 
automagically looks up the 'name' field for a given 'ID' if there is a 
connection.

So right now I'm outputting a table that has some data like this:
Row ID, Price, Price2, RepairName

And data for that looks a bit like:
*Row ID, Price, Price2, RepairName*
*1,   21.00, *   *10.00, *   *1*
*1,*   * 23.00,*   * 09.00,*   * 21*
*1,*   * 21.20,*   * 2.00, *   *998*

So there we have it - Cake spitting out the 'ID' on the RepairName field 
instead of an actual value.

>From my background I've a few different ways I can 'solve' this (those 
ideas including pulling an array of data for me to then do a manual 
'lookup' for each row we output) - but all of these ideas seem hacky when I 
am sure (and I have seen with the basic CRUD views) the auto magic 
behaviour doing this work for me.

So perhaps this is down to model associations, in which case can you 
explain, in real simple terms how I should solve my ID lookup issue?

I've many models inter connecting which I've tried to not alter too much 
(as Cake generated them for me).

I was thinking there must be something really obvious here because surely 
this sort of question would come up more often? Weird how Google comes up 
short for me (Perhaps I don't know the proper phraseology!) 

Cheers then
Paul 

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Multiple role Authorization not working (based on tutorial) Cake 2.5.4

2014-09-24 Thread MarkB
Hi,

I've the blog tutorial and am working on my own app, an event booking 
system, which has user registration with two user roles - unsurprisingly 
called 'user' and 'admin'. :)

I want 'users' to be able to change their own details and book on an event, 
and 'admins' to be able to do the usual adminy things. 

Authentication is working okay, but I can't get the authorisation element 
to work, using isAuthorized($user). If I log in as a non-admin user, I can 
still access the admin functions (by directly typing in the URL), all of 
which are prefixed with 'admin_'

I've looked all over this forum and beyond, but I can't find a solution. 
Can anyone please take a look at my code and see where I might be going 
wrong? It's starting to drive me mad and I'm thinking of just sticking a 
simple 'is the user an admin?' within each and every admin function.

I've tried it with and without  *Configure::write('Routing.prefixes', 
array('admin')); *in my app's *core.php*

(I've edited out non-relevent code for brevity)

*AppController.php*








*App::uses('Controller', 'Controller'); class AppController extends 
Controller { public $components = array( 'Session','Auth' => 
array('loginRedirect' => array('controller' => 'users', 
'action' => 'dashboard'),'logoutRedirect' => array('controller' 
=> 'pages', 'action' => 'home'), 'authError' => 'You must be logged in to 
view this page.', 'loginError' => 'Invalid username or password entered, 
please try again.', 'authenticate' => array( 'Form' => 
array('passwordHasher' => 'Blowfish', array('fields' => array('username' => 
'email', 'authorize' => array('Controller')  ));   pages that can 
be viewed without being logged in public function beforeFilter() {
$this->Auth->allow('login','index','add','home');} check to see 
logged-in user is an admin public function isAuthorized($user) {// 
Any registered user can access public functionsif 
(empty($this->request->params['admin'])) {return true;
}// Only admins can access admin functionsif 
(isset($this->request->params['admin'])) {return 
(bool)($user['role'] === 'admin');}// Default deny
return false;}}*
*UsersController.php*











*App::uses('AppController', 'Controller');class UsersController extends 
AppController {public $helpers = array('Html', 'Form', 'Session');  
  public $components = array('Session'); public function beforeFilter() 
{parent::beforeFilter();
$this->Auth->allow('login','index');} public function login() { // 
if we get the post information, try to authenticate if 
($this->request->is('post')) { if ($this->Auth->login()) { 
$this->Session->setFlash(__('Welcome, '. $this->Auth->user('fullname'))); 
$this->redirect($this->Auth->redirectUrl()); } else { 
$this->Session->setFlash(__('Invalid username or password')); } }  }
public function dashboard() {  code for dashboard stuff}
/ all the other code.}*


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.