re: authlogic.   Are you using any of the "fancy" features of
authlogic, or just using it right out the box.   If the former, I'd
google for more information on how to use Hobo with omniauth and/or
devise.  If you're just using it for standard authentication with
username/password, I'd use the Hobo authentication system.

re: declarative_authorization.   Looks very interesting.  If you've
got all your permissions set up in declarative_authorization, your
best bet is probably to build a module that can be included in all of
your user_models that implements the hobo permission functions by
calling out to declarative_authorization.

If you don't, then the hobo permission system can handle roles quite
well.   Just set your user model to has_many :roles, and then add some
helper functions to your user model that other model's permission
functions can easily call them, giving you the centralization benefit
that's one declarative_authorization's reasons for existing.

class Project < ActiveRecord::Base
   hobo_model
   ...
   belongs_to :entity
   ...

   def destroy_permitted?
      current_user.has_permission_foo_for? entity
   end
end

class User
   hobo_user_model
   ...
   belongs_to :entity
   has_many :roles
   ...

   def has_permission_foo_for?(target_entity)
      entity_id == target_entity.id && roles.where("name in (:roles)",
['Administrator', 'Project Leader']).size > 0
    end
end

I'm not suggesting you do that this way.   There are myriad ways to do
it, that's just one of them.   In this case I've hard-coded role names
and permissions, but they could easily be in the database instead.

Bryan


On Thu, Sep 27, 2012 at 2:59 PM, Dan <[email protected]> wrote:
> I'm interested in using Hobo to rebuild my application, but I have a
> requirement for role-based permissions.  I currently use authlogic and
> declarative_authorization, which together implement authentication and
> permissions based on roles in a single central document, rather than putting
> roles/permissions for every user in every model, controller and view.
>
> The application and database is shared by multiple company entities, and
> based on the user role within each entity they only see the menus and data
> allowed within their role.  A user at entity-1 can not see data from
> entity-2, and they do not see menu options or fields unless their role
> allows.
>
> Reading Hobo Permissions, I do not see a way to implement roles, it seems to
> require adding logic for each specific person rather than a group of users
> within a role.  Am I missing something?
>
> If I can't make standard Hobo Permissions work, has anyone created a plugin
> for Authlogic and Declarative_Authorization or is there documentation on how
> to replace the existing authentication/authorizations?
>
> Thanks in advance,
> Dan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Hobo Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/hobousers/-/adzF-7YkDuEJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/hobousers?hl=en.

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to