On Tue, Jul 8, 2008 at 5:33 AM, Raj <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
>  I need to restrict the users in a local network based on their IP
> address.
> The TurboGears identity provides identity.from_host('ip address')
> method for this.
>
> But,  cannot hard code all the IP addresses within the from_host()
> function.
>
> I am storing all the allowed IP addresses inside a look up table. So,
> I need to provide dynamic data within the from_host() function like
> from_host(ipaddresslist)
>
> Is it posiible?
>

I was once suggested to use:
"Why don't you write your own identity predicate?

Something like (after importing Predicate and identityPredicateHelper
from turbogears.identity)

class whatever_group(Predicate, IdentityPredicateHelper):
    error_message = "Not member of any group."

    def eval_with_object(self, identity, errors=None):
        if identity.groups:
            return True
        self.append_error_message(errors)
        return False

Then, you can use @require(whatever_group())
Untested but simple enough.
"

http://groups.google.com/group/turbogears/browse_frm/thread/2a7ed368f0ba26e5/9f618263f47d7b58?lnk=st&q=identity+and+many+groups#9f618263f47d7b58

Lucas

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to