Sunday, November 2, 2008

Re: Help with ACL

Hi Stinkbug,
Thanks again for your interest in helping me out. Sorry for the delay.
I was able to setup permission dynamically. But still it is not
proper. Before going further I will provide you my table structure

offices table:
id - int
name - varchar

groups Table
id - int
office_id - int
name - int

users table
id - int
group_id -int
name - varchar
password - varchar

The aco, aro and acos_aros table is created by cake console script. I
hope you dont need those tables. I have not altered it.
My requirement is to set up roles with permission set for controller/
action access. Each offices will have a set of groups. These 4 groups
will be common for all office and the rules are predefined for these
for groups. Even the administrator cannot change the roles for these
four groups. Rest of the groups cannot be the duplicate for any office
and the administrator can edit the permission for these groups.
Groups will have many users and these users are depended on the
office. That is user of office 'z' can be a part of group 'f' if and
only if 'f' is a child group of 'z' office. A user can have multiple
groups. I will post the code I have below. Now I am able to save a
group under an office with a set of permission correctly. My issue is
that:
1) I am not sure how to set 4 common groups to a offices when that
office is created.
2) I am not sure on how to set up multiple groups for a user.

Now I will provide the code I have done till date

MODEL
1) Office model - http://pastebin.com/m3f1f37de
2) Group model - http://pastebin.com/m4464956
3) User model - http://pastebin.com/m1e7543f

CONTROLLER
1) Groups Controller: http://pastebin.com/m315b2987

I have done nothing related to ACL in office and user controller. The
code which I have posted above was the result of lot of researches I
had done on ACL :D. I guess this would be enough for you to understand
what I am trying to do. I hope you will try to help me soon. Thanks
once again.


On Oct 31, 6:55 pm, Stinkbug <justink...@gmail.com> wrote:
> Well, so much for an answer soon.  Sorry about that.  Not sure if you
> still need help with this, but could you show us your aro and aco
> structures so I get get a better idea as to what you're trying to do.
>
> I think I see what you're trying to do, but let's see if you have a
> proper ACl setup first.
>
> On Oct 24, 5:45 am, jst4fun <swaroo...@gmail.com> wrote:
>
> > Well I had gone through the links which you guys had provided. Thanks.
> > But the issue for me to implement an ACL is that I am not sure what
> > all function should be used due to the lack of documentation. One of
> > the requirement is already discussed above. I think I was able to
> > implement it partially. What I did was to create three tables one
> > offices, groups and then users.I created parentNode() for group
> > binding it to the office model and in users binding every users to
> > group model. Now when I create a Group and select an office it is
> > correctly created in aros table. Same with the users too. I found a
> > script from cakebaker to list all controllers and save it as acos. Now
> > I have aros and acos setup. In my application a superadmin can add new
> > user, group and offices dynamically. This part i guess is already
> > solved, thanks to parentNode(). When the super admin takes the add
> > group page all the controllers with their actions are also displayed
> > in that page. Actions will be having checkboxes to enable or disable
> > that action to the user of that group. So my first doubt is
> > 1) How is it possible to save a group and then its associated
> > permissions dynamically?
> > Then definitely the admin might have to delete a office or a group. In
> > such a case
> > 2) How is it possible to delete all the office and its group and
> > remove the deleted group information from the users .
> > I hope I have made everything clear and hope to get a reply soon.
> > Thanks
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: