Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9195903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:43:54+00:00 2026-06-17T21:43:54+00:00

I have a question about the rbac system. I think I’ve pretty well understood

  • 0

I have a question about the rbac system. I think I’ve pretty well understood it but I need more informations about a special case.

I would like to do the autorisations on groups instead of users. I mean for instance the group "HR" has permission to create a person. Then any person who join this group would have it as well.

Let me give you more informations.

A part of my database:
enter image description here

And this a part of what my group hierarchy could be:
enter image description here

So what I’m looking for, this would be a must, is a system where each group has some autorizations. People get the autorizations of their group and of their parents group (for instance people in "Forsys" has the autorizations of "Forsys", "R&D" and "Administration").

The solution I see at the moment is using bizrule. But I’m not sure write php code in database is a good idea and then if I update the group hierarchy (R&D inherits of RH instead of Administration) I would have to modify bizrule in database. I tried it and it works well but as you can see it require a lot of code.

$user = User::model()->with("people","people.groups")->findByPk(Yii::app()->user->id);
foreach($user->people[0]->groups as $group)
  if($group->id == 2)
     return true;
return false;

It’s just for see if a user is in a group (without checking parent groups and hierarchy)

Another possibility could be create a new table "group_auth" where we would say for instance:

-Group_2 has role "managePerson"

-Group_3 has operation "deleteUser"
…

And then everytime a user is added in or removed of a group we would update his autorizations in the auth_assigment table.

I’d like to hear other opinions on this subject.
All comments will be appreciated 🙂

Thank you for reading and sorry for my English if you had difficulties to understand me.

Michaël S.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T21:43:56+00:00Added an answer on June 17, 2026 at 9:43 pm

    Do users ever get their own authorization items? If not, seems like you could in essence swap out the userid column in auth_assignment and name it / treat it as groupID instead. That way you wouldn’t need to worry about keeping user auth assignments in sync with your group roles.

    A couple of places you’d probably need to make some changes:
    – by default CWebUser passes in the logged in userid for use in bizrules. Might be good to change that our with your own override that passes in groupId/groupIds instead.
    – you’d need to override CDbAuthManager and rework some of how things work there

    We’ve done something similar on a project I’ve worked on (we were handling multi-tenant RBAC custom permissions), which required custom CDbAuthManager overrides. It gets a bit tricky if you do it, but there is an awful lot of power available to you.

    Edit:
    Understood about your users sometimes needing to have additional authorizations. What if your group has a ‘roles’ field with different roles serialized in it (or some other method of having multiple roles stored for that group, could also be a relationship).

    Then, on user login (for efficiency), you’d store those roles in session. Probably the easiest way to handle things would be to write a custom checkAccess for your WebUser override:
    https://github.com/yiisoft/yii/blob/1.1.13/framework/web/auth/CWebUser.php#L801

    as that will make things simpler to do your custom checking. Then I’d probably do something like:

    if(Yii::app()->user->hasGroupAccess() || Yii::app()->user->checkAccess('operation/task/role')) {
        ....
    }
    

    In your WebUser hasGroupAccess method, you could loop over all group roles and send those to checkAccess as well.

    Think that will work?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have question about site performance. I have 4 large images (1920*500px) that need
I have question about the need of using @configurable . I have gone through
I have question about jqgrid, what the purpose of position:last in jqgrid? for more
I have question about this plugin system: .NET 4.0 ASP.NET MVC 3 plug-in architecture
I have a question about URI template variables. I need to manage an URI
I have a question about looping in JavaScript. Mostly I use jQuery but now
I saw a lot of examples of CopyStream implementation but I have question about
I have question about parsing in Html helper : I have sth like: @foreach
I have question about clean thory in Python. When: @decorator_func def func(bla, alba): pass
I have question about XSLT1.0. The task is to write out in HTML all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.