Hi, I have a class called Node, and I have a view_permitted? function
that works fine.

class Node ...

  def view_permitted?(attribute)
    acting_user.signed_up? && ...
  end
  ...
end

I have another class called CodeGen that can generate some kind of
code using the to_code(n) function, where n is a node.  Similar to
this:

class CodeGen...

  def to_code(n)
    "Generated code for "+n.to_s
  end
  ...
end

This works very fine.

Now I want to allow using the to_code(n) function to those people that
are allowed to view the n argument Node.

class CodeGen ...

  def to_code_permitted? (attributes)
     # Return correspondant Node.viewable_by?() answer, using the n
node instance
     # Do not know how.
  end
  ...
end

Is it possible to use the Hobo permission system to get this working?
If not, it is possible to add an elegant check inside the to_code
function to change the code generated?

  def to_code(n)
    allowed=... some kind of elegant check ...
    if (allowed)
       "Generated code for "+n.to_s
    else
       "No code for you!!!"
    end
  end

Thank you!!!

Tx.
--~--~---------~--~----~------------~-------~--~----~
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