Skip to main content

Django row level object sharing app.

Project description

Django Sharing

Django row level sharing app limiting content access by user in Django admin.

Features

  1. Provides admin view, change and delete permissions, restricting content access and limiting available actions per user.

  2. Filters ForeignKey fields by view permissions.

  3. Filters ManyToManyField fields by view permissions.

  4. Automatically enables sharing on all admin classes (optional).

Installation

  1. Install or add django-sharing to your python path.

  2. Add 'sharing' to the project’s INSTALLED_APPS setting.

  3. Add 'sharing.backends.SharingBackend' to the project’s AUTHENTICATION_BACKENDS setting.

Usage

In order for django-sharing to limit content access your various admin classes need to include the ShareAdminMixin class. For example:

# admin.py
from django.contrib import admin
from sharing.admin import ShareAdminMixin

class ArticleAdmin(ShareAdminMixin, admin.ModelAdmin):
    pass

admin.site.register(Article, ArticleAdmin)

It is crucial for ShareAdminMixin to be the first ancestor class in the admin class’ definition.

Alternatively you can automatically enable sharing for all models registered with the admin site. django-sharing includes an admin_mixin_share method which will apply the ShareAdminMixin class to all models registered with the admin site. Call the method after admin.autodiscover() in urls.py:

# urls.py
from django.conf.urls.defaults import *
from django.contrib import admin

import sharing

admin.autodiscover()
sharing.admin_mixin_share()

urlpatterns = patterns('',
    (r'^admin/', include(admin.site.urls)),
)

Once the ShareAdminMixin class has been applied your admin change views should include Group and User share inlines and restrict content appropriately.

Authors

Praekelt Foundation

  • Shaun Sephton

Changelog

0.0.1

  1. Initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-sharing-0.0.1.tar.gz (8.1 kB view details)

Uploaded Source

Built Distributions

django_sharing-0.0.1-py2.6.egg (15.0 kB view details)

Uploaded Source

django_sharing-0.0.1-py2.5.egg (15.0 kB view details)

Uploaded Source

File details

Details for the file django-sharing-0.0.1.tar.gz.

File metadata

File hashes

Hashes for django-sharing-0.0.1.tar.gz
Algorithm Hash digest
SHA256 10faad32fd40bf7cc9ed204852eddd2130cc1767f2f9d94f1be84885d5759ce6
MD5 5662ff45e6c945e2f2864f0ea2e0032b
BLAKE2b-256 a0d32187e7175d6f606e96ff18a2f7fd5bb533108b8f1ef6b0bd43c3d52e4686

See more details on using hashes here.

Provenance

File details

Details for the file django_sharing-0.0.1-py2.6.egg.

File metadata

File hashes

Hashes for django_sharing-0.0.1-py2.6.egg
Algorithm Hash digest
SHA256 cbff8bffc9e1ea008ea706a86ec797f890499f1354817ab7ee7caace5da582a3
MD5 d8dffacf6d19b06dc01eba57cbd6b2ac
BLAKE2b-256 59118eacc0a2bf5dfd8bda5343a759c783bb21384c209699c5740a0cf10cf261

See more details on using hashes here.

Provenance

File details

Details for the file django_sharing-0.0.1-py2.5.egg.

File metadata

File hashes

Hashes for django_sharing-0.0.1-py2.5.egg
Algorithm Hash digest
SHA256 d98a9ab8ddcc6dc81f56bd52f8516c2d9f4e3f32e09cf9ac968b28e5c4657695
MD5 b16dad6cd180c36aae08190cab22080b
BLAKE2b-256 aed2020e4435a643d24dfa0fd476633a497a3909192a516d6b4974517a905148

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page