Skip to content
This repository has been archived by the owner on Dec 3, 2018. It is now read-only.

SEED-platform/seed-superperms

Repository files navigation

seed-superperms

Flexible user permissions for the SEED Platform.

Install

install superperms

add superperms to your INSTALLED_APPS

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.flatpages',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',
    'django.contrib.humanize',
    'django.contrib.admin',

    'superperms.orgs',
)

Configuration Options

  • ALLOW_SUPER_USER_PERMS: Allows Django super_user class accounts to bypass permissions checks. This is useful mainly for development, but defaults to True.

Example Usage

  • To limit views to people who have member-level roles and above, you could use the following decorator definiition. Users who are viewers will recieve a Django HttpRequestNotAuthorized response (e.g. a 403) without ever executing the code inside the view.
from superperms.orgs.decorators import has_perm #  Imports our decorator factory.

# This view will be protected against anybody whose account is "lower"
# than a member. Default role types include ['owner', 'member', 'viewer'].
@has_perm('requires_member')
def protected_view(request):
    pass

Development and Testing

clone the repo and install requirements

$ git clone [email protected]:seed-platform/seed-superperms.git
$ mkvirtualenv superperms
(superperms)$ cd superperms
(superperms)$ pip install -r requirements.txt

tests should pass, PEP8 is enforced

(superperms)$ ./test.sh

Copyright

Copyright © 2014 Building Energy Inc.

About

Expanded permissions handling for SEED

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published