Override project.is_public
Added by Emmanuel Lacour over 14 years ago
Using 0.9.3, I have a need that a group should be reporter to all projects. But I don't want that this group members be listed in project roles (too many users). So I think one quick way to do this is to override the is_public method for projects (which we do not use) to give this right.
I tried to make something like this in app/models/project.rb, but it doesn't seems to be called:
def self.is_public public_group = Group.find_by_lastname('foo') current_user = User.current if current_user && public_group && current_user.group_ids.include?(public_group.id) return true else return false end end
any idea?
Replies (2)
RE: Override project.is_public [solved] - Added by Emmanuel Lacour over 14 years ago
I solved this using:
def is_public?
instead of
def self.is_public
there was also some needs to patch other places, see attached patch that makes people in group "ee" see all projects by overriding public feature.
May be usefull to someone else;)
RE: Override project.is_public - Added by Corentin Merot over 13 years ago
I'm interested in that feature too, i've updated the patch for the last stable (1.2.0). I'm new to Ruby so not too much confident. Would somebody check it? Thanks