The documentation says that it is not provided by the auth system and  
not built into the admin, but it may be possible.  One thing you  
should try is to build a custom manager for your model and use  
threadlocals (search the archives for this) to enable this.  Something  
like:

class Stories(models.Model):
        name = charfield()
        owner = FK(User)

        permissible = PermissionManager()
        
class PermissionManager(models.Manager):
        def all(self):
                return (self.model.objects.filter(owner__exact =  
threadlocals.get_current_user())

        def get(self, id):
              obj = self.model.objects.get(pk=id)
                if  obj.owner == threadlocals.get_current_user():
                        return obj

I use this technique with a very robust role-based authorization  
system in an app I am working on, though I do not use the built in  
admin.  This may work with the built in Admin, I am not sure as I have  
not tried it, but this is what I would try.  If you are not going to  
use the Admin, this is not difficult to enable just by checking the  
owner in your view.  You will need to do this for any custom views  
with this as well via Stories.permissible.get(pk=1) and  
Stories.permissible.all()
HTH,
-richard


On May 1, 2008, at 10:22 PM, Ronny Haryanto wrote:

>
> On Fri, May 2, 2008 at 10:04 AM, Rit Lim <[EMAIL PROTECTED]> wrote:
>> "Mary may change news stories, but only the ones she created
>> herself..."
>>
>> How do I go about doing that? I was told I need to write an ACL.
>> However, I'm not sure how to do it.
>>
>> Anyone has some sample code?
>
> The documentation clearly says that it's not currently possible (that
> is if you're using django's auth system).
> http://www.djangoproject.com/documentation/authentication/#permissions
>
> Ronny
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to