crisu83 / yii-rights

Automatically exported from code.google.com/p/yii-rights
BSD 3-Clause "New" or "Revised" License
2 stars 4 forks source link

Compatibility with Yii 1.1.8, case sensitive table names #56

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Upgrade yii to 1.1.8
2. Upgrade the database schema to use camel case table names.
3. Do anything related to rights, where it reads from the database.

What is the expected output? What do you see instead?

Sql error:
Undefined table: 7 ERROR: relation "authitem" does not exist
The SQL statement executed was: SELECT 
name,t1.type,description,t1.bizrule,t1.data,weight
FROM AuthItem t1
LEFT JOIN Rights t2 ON name=itemname
ORDER BY t1.type DESC, weight ASC 

There are no double quotes.

What version of the product are you using? On what operating system?
PostgreSQL 9.0
Yii 1.1.8
Rights 1.3.0r147

Please provide any additional information below.
When NOT using table names with double quotes in Postgres it assumes the table 
name is all lowercase. New yii 1.1.8 started to use quotes, but not all Rights 
queries use quotes.

Original issue reported on code.google.com by janek....@gmail.com on 6 Jul 2011 at 7:05

GoogleCodeExporter commented 9 years ago
Seems it just takes adding quotes in the query string in 
modules/rights/components/RDbAuthManager.php
I just wonder how it will affect compatibility with other DBs backends.

Original comment by janek....@gmail.com on 6 Jul 2011 at 7:17

GoogleCodeExporter commented 9 years ago
I had the same problem, but I fixed them as fellow:
1. open the file in yii framework (yii/framework/web/auth/CDbAuthManager.php
2. check tables' name of your database in PostgreSQL.
3. rename the variables ($itemTable, $itemChildTable, ... ets), the same as 
your tablename.

My system work well now. Good Luck.    

Original comment by CJHuang...@gmail.com on 15 Aug 2011 at 4:57

GoogleCodeExporter commented 9 years ago
It works!

Original comment by emo...@altus.co.cr on 16 Aug 2011 at 5:37

GoogleCodeExporter commented 9 years ago
I had a similair problem, couldnt understand why until I realised my webhost 
probably used a linux server... and booya. I always use lowercase only on 
tablenames and my localhost is a win computer and I uploaded the page long 
after I had rights working on my localhost. So remember to check 
RDbAuthManager.php and compare the rightstable  name with you'r database table^^

Original comment by iDr...@gmail.com on 6 Jan 2012 at 3:09