Checking for authorization during ajax calls
This is the code in beforeFilter in AppController: if (!$this->user && //User not logged in $this->request->isAjax() && !in_array($this->request->params['action'], $this->Auth->allowedActions)){ //Is an action that requires to be logged in $ret['mustLogin'] = true; echo json_encode($ret); return; } It works well for controls with $this->Auth->allow('myaction', 'myotheraction') or that do not have a Auth->allow but for the controllers that have: $this->Auth->allow('*') it does not work. In these cases $this->Auth->allowedActions is empty. Is it a bug? Is there a workaround? Best, Chris -- --Everything should be made as simple as possible, but not simpler (Albert Einstein) -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: complex query with virtual fields
I was going to suggest replacing the balance_due in the 2nd query with the 1st complex query, but it looks like that would become pretty messy. So, why not just add a balance column to the invoices table and update it from the model? On Fri, Oct 26, 2012 at 6:05 PM, fly2279 wrote: > I am trying to get an accounts aging report to work correctly. I want to > find all customers that have invoices with a balance within a date range. > > Invoice hasMany Transaction - the transactions are payments made on that > invoice, I have a virtual field in the Invoice model that takes the total > invoice minus the sum of the transactions that belong to that invoice. The > 'balance_due' virtual field in the Invoice model has this sql 'SELECT > IF(SUM(amount) IS NOT NULL, Invoice.total_due - SUM(amount), > Invoice.total_due) FROM transactions WHERE transactions.invoice_id = > Invoice.id'. > > In my Customer model that hasMany Invoice I want to retrieve all the > customers and have a virtual field that has the total amount due based on a > date. What I have for my 'aging' virtual field in the Customer model is: > 'SELECT IF(SUM(balance_due) IS NOT NULL, SUM(balance_due), 0) FROM invoices > WHERE invoices.balance_due > 0 AND invoices.due_date > \''.date('Y-m-d', > strtotime('31 days ago')).'\' AND invoices.customer_id = Customer.id' > > The customer's virtual field would work correctly if it was using a real > column in the invoices table. How do I change the sql string to replace > balance_due with something that will look like the result in the Invoice > model? Do I need some kind of join or subquery? > > -- > 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 post to this group, send email to cake-php@googlegroups.com. > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
complex query with virtual fields
I am trying to get an accounts aging report to work correctly. I want to find all customers that have invoices with a balance within a date range. Invoice hasMany Transaction - the transactions are payments made on that invoice, I have a virtual field in the Invoice model that takes the total invoice minus the sum of the transactions that belong to that invoice. The 'balance_due' virtual field in the Invoice model has this sql 'SELECT IF(SUM(amount) IS NOT NULL, Invoice.total_due - SUM(amount), Invoice.total_due) FROM transactions WHERE transactions.invoice_id = Invoice.id'. In my Customer model that hasMany Invoice I want to retrieve all the customers and have a virtual field that has the total amount due based on a date. What I have for my 'aging' virtual field in the Customer model is: 'SELECT IF(SUM(balance_due) IS NOT NULL, SUM(balance_due), 0) FROM invoices WHERE invoices.balance_due > 0 AND invoices.due_date > \''.date('Y-m-d', strtotime('31 days ago')).'\' AND invoices.customer_id = Customer.id' The customer's virtual field would work correctly if it was using a real column in the invoices table. How do I change the sql string to replace balance_due with something that will look like the result in the Invoice model? Do I need some kind of join or subquery? -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Help with Deployment: CakePHP App (AppServer) behind Firewall with a Seperate WebServer
I don't think there's anything special that's specific to Cake. It shouldn't be any different than if you were using anything else. On Thu, Oct 25, 2012 at 8:10 PM, Blues Clues wrote: > Hi > I am lost here. We need to deploy our first CakePHP application using 3-tier > architecture as follows. My CakePHP already works on my localhost however, > we need to place CakePHP app inside firewall and have webserver outside > firewall that actually processes user requests. > > How can we deploy something like this?. We need to protect all the code > written (Controllers, Models, Views) in CakePHP by keeping it behind > firewall. > > Required Architecture: > > 1. Web Server - Just receives requests/sends responses back to the user. > This is outside firewall. > > 2. App Server - This is where we have CakePHP code. Receives Requests 'Only' > from webserver and processes requests using CakePHP M-V-C and responds to > WebServer. > > 3. Database Server - This is where we have Database engine running. This > server receives requests from AppServer. CakePHP AppServer simply connects > to this Database Server. > > As of now, my localhost has Web/AppServer running. I don't like this > architecture as my localhost has CakePHP code developed by us. > > Any ideas...I thought this is no brainer but now, I am perplexed as how I > can split WebServer and AppServer(CakePHP). > > Thanks > Blues Clues > > -- > 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 post to this group, send email to cake-php@googlegroups.com. > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Sending mail through Gmail with CakeEmail (again)?
I just found out that my timeout settings were the culprit for this error. I upped my timeout property from 3000 to 30.000 and my test passes (the email has been sent). The "only" drawback is that the mail takes ages to go through (about 2 minutes on average.. :D). This makes this solution useless, unless I make my own queue of emails and run a cronjob on it... So, I guess I should use my own server's smtp for sending notifications. Which is a question for another forum Thanks guys, your answers are much appreciated. -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.