Coder Social home page Coder Social logo

django-session-controller's Introduction

django-session-controller : A Configurable Session Controller ๐Ÿ•ต๐Ÿป

Django session controller controls the number of sessions a user can hold in application life cycle . Admin/Staff user can configure number of active user sessions at the app level or at the view level.

Features:

  • Can be configurable to restrict no of sessions on the whole application.
  • Can be configurable to restrict no of sessions on a particular view.
  • Can be configurable to restrict no of sessions for each user.
  • Auditable user sessions history .

How To Install:

To install django-session-controller simply use pip :

$ pip install django-session-controller

How to use :

  1. Add django-session-controller to your Django project's settings module:
    INSTALLED_APPS = [
        ...
        'django-session-controller',
        ...
    ]
    
    MIDDLEWARE = [
        ...
        'django-session-controller.middleware.SessionController',
        ...
    ]
  1. Apply the django-session-controller migrations to your project's database:

    python manage.py migrate django-session-controller

3.Put the below code to your Django project's settings module inorder to configure:

   
     #Restrict sessions
    SESSION_CONTROL_CONFIG = {
        'SESSION_CONTROL_APP_LEVEL': True, # to control no of sessions on App level
        'MAX_SESSION_CNT' : 2, # to control no of concurrent sessions for any user
        'SESSION_CONTROL_USER_LEVEL': True,# to control no of sessions for each user
        'SESSION_CONTROL_VIEW_LEVEL': True #control session at View level
    }

4.Use @unique_session decorator on view method to impose session restriction.

    
    from django_session_controller.session_decorators import unique_session
    class IndexView(LoginRequiredMixin, ListView):
        @unique_session
        def get(self, request, *args, **kwargs):
            pass

5.To make you session monitoring system use the model UserSessionStore.


    from django_session_controller.models import UserSessionStore

Future Works :

  • Support for token based Auth system
  • Manage the session restriction on User group level
  • A better session monitoring for admins

Contributors

License

The project is licensed under the MIT license.

django-session-controller's People

Contributors

iamsibasish avatar naveen-varshney avatar sdas1980 avatar viswanathreddy avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

iamsibasish

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.