多个应用程序可以共享相同的ACL表吗?

时间:2022-10-20 15:57:20

Currently I have to share my database with many CakePHP applications and the tables are prefixed to identify each application respectively.

目前,我必须与许多CakePHP应用程序共享我的数据库,并且表格前缀以分别标识每个应用程序。

So, can many applications share the same ACL tables?

那么,许多应用程序可以共享相同的ACL表吗?

Or, I could change the default names of the tables ACL and add the prefix of each application, eg. app_aros, app_acos, app_aros_acos?

或者,我可以更改表ACL的默认名称,并添加每个应用程序的前缀,例如。 app_aros,app_acos,app_aros_acos?

/* beforeFilter() @ AppController */
$this->Acl->Aro->useTable = 'app_aros';
$this->Acl->Aco->useTable = 'app_acos';

This code worked but I haven't found a way to change the tablename of the model Permission...

这段代码有效,但我还没有找到一种方法来改变模型的表名Permission ...

Suggestions? What could I do?

建议?我能做什么?

1 个解决方案

#1


2  

You have change this line in app/Config/core.php in all of your apps

您已在所有应用中的app / Config / core.php中更改此行

Configure::write('Acl.database', 'default'); 

to:

至:

Configure::write('Acl.database', 'your_acl_connection');

And also add connection in app/Config/database.php

并在app / Config / database.php中添加连接

example:

例:

public $your_acl_connection = array(
        'datasource' => 'Database/Mysql',
        'persistent' => false,
        'host' => 'localhost',
        'login' => 'user',
        'password' => 'password',
        'database' => 'database_name',
        'prefix' => '',
        //'encoding' => 'utf8',
    );

Simply you will have one DB for managing all yours app ACLs. In this DB you create all ACL tables.

您只需拥有一个数据库来管理所有应用程序ACL。在此DB中,您将创建所有ACL表。

#1


2  

You have change this line in app/Config/core.php in all of your apps

您已在所有应用中的app / Config / core.php中更改此行

Configure::write('Acl.database', 'default'); 

to:

至:

Configure::write('Acl.database', 'your_acl_connection');

And also add connection in app/Config/database.php

并在app / Config / database.php中添加连接

example:

例:

public $your_acl_connection = array(
        'datasource' => 'Database/Mysql',
        'persistent' => false,
        'host' => 'localhost',
        'login' => 'user',
        'password' => 'password',
        'database' => 'database_name',
        'prefix' => '',
        //'encoding' => 'utf8',
    );

Simply you will have one DB for managing all yours app ACLs. In this DB you create all ACL tables.

您只需拥有一个数据库来管理所有应用程序ACL。在此DB中,您将创建所有ACL表。