ruby on rails - advice for structure and user access -


OK so I have ACL 9 place and function, and my app structure is still there:

The area (those with whom) the location (whose sale is) is not important, basically there are just posts that will be displayed in every place.

I also have users who can integrate with ACL 9 and can give permission on the basis of role.

What I need to do is create companies and users created for a given company are allowed only for areas and places within that company. I would then need those users who can make each company, who have only access to the place from which they are given access.

My question is that I am not sure that a built-in user dynamically means that a certain section, the interface for the administrator. I can imagine some methods, but I am looking for the best advice.

The method for the user "has_role?"

  class user & lt; ActiveRecord :: Base def is_role? (Role_name, obj = nil) # Your code end and  

If the object type is "area" or "location", then you check the user's company and allow use if The area is fair. Otherwise, you call "super" and get it the default value of ACL9.

This will give you something like this:

  class users & lt; ActiveRecord :: Base def is_role? (Role_name, obj = nil) super until obj.class == area or obj.class == return location company.region == obj if obj.class == return area company.location == obj obj.class == End of the end of the place  

Then there is only one implementation suggestion that they have almost an infinite number and I have never said that this is the best.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -