Multi Company Signup And Authorization Architecture

Hello All,

I am new to Yii and have 3 projects that all require the structure below. I would like to create something that is flexible and where i can use the architecture for all three projects.

I am currently looking at the rights and users modules and would like to get input from the ‘professionals’ before proceeding.

Any suggestions appreciated.

Regards,

Dennis

Multiple companies can signup

Each company is separate

Each company to maintain own company details

Each company to setup its own users

Each user can have different rights

3 levels within each company like Admin/Manager/Staff

Sample Required Structure

Company 1

-Admin


   -menu item 11


   -menu item 12


   -menu item 13


-Manager


   -menu item 11


   -menu item 12


-Staff


   -menu item 11

Company 2

-Admin


   -menu item 21


   -menu item 22


   -menu item 23


-Manager


   -menu item 21


   -menu item 22


-Staff


   -menu item 21

etc…

I’ll make company module, then i’ll structure users’s link to company, as this:

companies:

  • id;
-name;

[other details]

users:

- id;


- company_id (link to company);


 ...

[other details]

For menu i’ll use the same for all companies, so same menu items.

you will be required create tables

users - user_id, role_id, company_id…

and

company - company_id…

Roles will be will be referring the roles "Admin/Manager/Staff" , if required you can maintain separate table for roles also.

for access purpose create privileges tables

privileges_id | (privilages_name) | access_to_role

e.g

1 | add_manager | admin

2 | edit_manager | admin

3 | delete_manager | admin

4 | add_staff | Manager

5 | edit_staff | Manager

6 | delete_staff | Manager

and so on

Note : for access_to_role add role id

in this table you can add all the permissions.

in controller action call function check_access(‘add_manager’)

function check_access will get the logged in user role type and check the privilages table if do not have access it will redirect to the no-access page.

Hello and thank you for your responses.

I understand the potential solution you have proposed.

I currently have the yii ‘rights’ module installed with the following tables

Authassignment

Authitem

Authitemchild

Rights

I am trying to understand how this module would for my requirements.

Given that i want to have many companies with the 3 roles in each company, I would like to find something that is already created so i do not have to reinvent the wheel.

Do you have any suggestions?

Regards,

Dennis

AS per my understanding there is no such module present in Yii.

http://www.yiiframework.com/extension/rights/

hey that’s the great one…i am also searaching for similar one…its really good. you can use this rights.

Have know the similar kinda of functionality and module present in Xaraya CMS.

I want to use something that is very flexible and the rights module looks good.

It is somewhat complex for myself since i have not done much programming before.

I will still require other tables to manage some other rights items.

I will also be looking for some individuals to hire shortly to assist me on this project.

if required i can do this for you. :)

hi,

I have good exp to work on permission module of xarayawww.xaraya.com framework. and i am not finding it would be difficult for me to work on yii rights module as its looks similar as and general conceptof permission and authentication.

I have nearly 6 yr of exp to work on content management system xaraya, yii.

e.g jetaviation.com is the one of the site i have worked on which implemented same kind of functionality

Please check if i can do any help for your project

use yii rights with yii user module

try this wiki

http://www.yiiframework.com/wiki/423/installing-yii-users-and-rights-to-newly-created-yii-app/

thats the best combination in yii