Skip to content

Commit

Permalink
Merge pull request #56 from unlimitedlabs/hijack
Browse files Browse the repository at this point in the history
Incorporate optional user hijack
  • Loading branch information
jrbotros committed Oct 16, 2015
2 parents 7052ea7 + 74e82b8 commit 628dd76
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/source/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ Alternatively, just make sure to add the following code inside the
url(r'^orchestra/accounts/',
include('registration.backends.default.urls')),

# Optionally include these routes to enable user hijack functionality.
url(r'^orchestra/switch/', include('hijack.urls')),

# Logout then login is not available as a standard django
# registration route.
url(r'^orchestra/accounts/logout_then_login/$',
Expand Down
6 changes: 6 additions & 0 deletions example_project/example_project/orchestra_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def setup_orchestra(settings_module_name):
'orchestra',
'beanstalk_dispatch',
'registration',
'hijack',
'compat'
)

settings.STATICFILES_FINDERS += (
Expand Down Expand Up @@ -90,6 +92,10 @@ def setup_orchestra(settings_module_name):
settings.ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window
settings.REGISTRATION_AUTO_LOGIN = True # Automatically log the user in.

# Prevent hijack buttons from displaying in admin (otherwise, hijack can't
# be disabled by excluding the relevant URLs)
settings.SHOW_HIJACKUSER_IN_ADMIN = False

# API Authentication
#####################

Expand Down
2 changes: 2 additions & 0 deletions example_project/example_project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
# Allows access to request object in templates; currently used
# for displaying hijack notification
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
Expand Down
3 changes: 3 additions & 0 deletions example_project/example_project/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
url(r'^orchestra/accounts/',
include('registration.backends.default.urls')),

# Optionally include these routes to enable user hijack functionality.
url(r'^orchestra/switch/', include('hijack.urls')),

# Logout then login is not available as a standard django
# registration route.
url(r'^orchestra/accounts/logout_then_login/$',
Expand Down
10 changes: 10 additions & 0 deletions orchestra/static/orchestra/common/css/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ a.logo {
}
}

#hijacked-warning {
left: 25%;
width: 50%;
border-radius: 0 0 5px 5px;
> span:last-child {
// Hack to override button container inline style
margin-right: 0 !important;
}
}

.section-panel {
margin: $panel-button-margin;
box-shadow: 0 1px 3px black;
Expand Down
4 changes: 3 additions & 1 deletion orchestra/templates/orchestra/base.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% load compress %}
{% load staticfiles %}
{% load hijack_tags %}

<!DOCTYPE html>
<html lang="en" ng-app="orchestra">
Expand All @@ -23,6 +24,7 @@
<!-- Custom styles for this template -->
<link rel="stylesheet" href="{% static 'orchestra/common/css/lib/style.css' %}">
<link rel="stylesheet" href="{% static 'orchestra/common/css/lib/style-responsive.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'hijack/hijack-styles.css' %}" />
<link rel="stylesheet" type="text/x-scss" href="{% static 'orchestra/common/css/orchestra.scss' %}">
<link rel="stylesheet" href="{% static 'orchestra/common/components/quill/css/quill.snow.min.css' %}">
<link rel="stylesheet" type="text/x-scss" href="{% static 'orchestra/common/components/quill/css/quill.scss' %}">
Expand All @@ -43,7 +45,7 @@
</head>

<body>

{{ request|hijackNotification }}
<section id="container" >
<!--header start-->
<header class="header">
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ django-libsass==0.3
slacker==0.7.0
pandas==0.16.2
python-dateutil==2.4.2
django-hijack==1.0.9

# Documentation requirements
Sphinx==1.3.1
Expand Down

0 comments on commit 628dd76

Please sign in to comment.