mandaye_cud: update to the last mandaye version

This commit is contained in:
Jérôme Schneider 2014-09-01 12:17:22 +02:00
parent 6afb3ae65c
commit c370e1bd17
20 changed files with 186 additions and 587 deletions

View File

@ -1,3 +1,4 @@
include COPYING MANIFEST.in VERSION
include mandaye_cud/default-config.ini
recursive-include mandaye_cud/templates *.html
recursive-include mandaye_cud/static *

View File

@ -1 +1 @@
__version__="0.0.1"
__version__="0.1.0"

View File

@ -1,16 +1,36 @@
import logging
import os
_PROJECT_PATH = os.path.join(os.path.dirname(__file__), '..')
from ConfigParser import SafeConfigParser
from mandaye.exceptions import ImproperlyConfigured
# get configuration files from :
# 1. default-settings.ini from source code
# 2. os.environ.get('SETTINGS_INI') if it exists
# else /etc/mandaye-cam/config.ini
# and then /etc/mandaye-cam/local-config.ini
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
SETTINGS_INI = (os.path.join(BASE_DIR, 'default-config.ini'),)
if os.environ.get('SETTINGS_INI'):
SETTINGS_INI += (os.environ.get('SETTINGS_INI'),)
else:
ETC_DIR = os.path.join('/', 'etc', 'mandaye-cam')
SETTINGS_INI += (
os.path.join(ETC_DIR, 'config.ini'),
os.path.join(ETC_DIR, 'local-config.ini')
)
config = SafeConfigParser()
config.read(SETTINGS_INI)
## SQL Backend config
# Database configuration
# http://docs.sqlalchemy.org/en/rel_0_7/core/engines.html
# rfc 1738 https://tools.ietf.org/html/rfc1738
# dialect+driver://username:password@host:port/database
db_url = 'sqlite:///' + os.path.join(_PROJECT_PATH, 'mandaye_cud.db')
db_url = config.get('database', 'url')
debug = False
debug = config.getboolean('debug', 'debug')
# Log configuration
LOGGING = {
@ -22,8 +42,9 @@ LOGGING = {
'format': '%(asctime)s %(levelname)s %(message)s',
'datefmt': '%H:%M:%S',
},
'syslog': {
'format': '%(name)s %(levelname)s %(uuid)s %(message)s',
'file': {
'format': '%(asctime)s %(levelname)s %(uuid)s %(message)s',
'datefmt': '%Y-%m-%d %H:%M:%S'
}
},
'handlers': {
@ -33,67 +54,56 @@ LOGGING = {
'formatter': 'console'
},
'syslog': {
'level': 'INFO',
'level': 'DEBUG',
'class': 'entrouvert.logging.handlers.SysLogHandler',
'formatter': 'syslog',
'formatter': 'file',
'address': '/dev/log'
},
},
'loggers': {
'': {
'handlers': ['console'],
'level': 'DEBUG',
'propagate': False,
},
'mandaye': {
'handlers': ['console', 'syslog'],
'level': 'DEBUG',
'propagate': False,
},
'mandaye_cud': {
'handlers': ['console', 'syslog'],
'level': 'DEBUG',
'propagate': False,
},
'loggers': {
'': {
'handlers': ['console'],
'level': 'INFO',
'propagate': False,
},
}
'mandaye': {
'handlers': ['console', 'syslog'],
'level': 'INFO',
'propagate': False,
},
'cam': {
'handlers': ['console', 'syslog'],
'level': 'INFO',
'propagate': False,
},
},
}
if config.getboolean('debug', 'log_debug'):
LOGGING['loggers']['']['level'] = 'DEBUG'
LOGGING['loggers']['mandaye']['level'] = 'DEBUG'
LOGGING['loggers']['cam']['level'] = 'DEBUG'
## PATH
# Template directory
template_directory = os.path.join(_PROJECT_PATH, 'mandaye_cud/templates')
# Configuration directory
config_root = os.path.join(_PROJECT_PATH, 'conf.d')
config_root = config.get('dirs', 'config_root')
# Templates directories
templates_directories = []
if config.get('dirs', 'templates_directories'):
templates_directories = config.get('dirs', 'templates_directories').split(' ')
templates_directories.append(os.path.join(BASE_DIR, 'templates'))
# Static url
static_url = '/mandaye/static'
static_url = config.get('dirs', 'static_url')
# Static folder
static_root = os.path.join(_PROJECT_PATH, 'mandaye_cud/static')
static_root = config.get('dirs', 'static_root')
# Data dir
data_dir = os.path.join(_PROJECT_PATH, 'data')
data_dir = config.get('dirs', 'data_dir')
# Raven Sentry configuration
raven_dsn = None
# Email notification configuration
email_notification = False
email_prefix = '[Mandaye mandaye_cud]'
smtp_host = 'localhost'
smtp_port = 25
email_from = 'traceback@entrouvert.com'
email_to = ['admin@localhost']
# Use long traceback with xtraceback
use_long_trace = True
# Ask Mandaye to auto decompress a response message
# Decompress response only if you load a filter
auto_decompress = True
# Encrypt service provider passwords with a secret
# You should install pycypto to use this feature
encrypt_sp_password = False
# Must be a 16, 24, or 32 bytes long
encrypt_secret = ''
# template vars
template_vars = {}
if config.has_section('template_vars'):
for option in config.options('template_vars'):
template_vars[option] = config.get('template_vars', option)
# Supported authentification
authentifications = {
@ -102,25 +112,62 @@ authentifications = {
# sp mappers
mappers = {
'linuxfr': 'mandaye_cud.mappers.linuxfr_example'
'linuxfr': 'mandaye_cud.mappers.linuxfr_example',
}
# Beaker session configuration
session_opts = {
'session.type': 'file',
'session.cookie_expires': True,
'session.timeout': 3600,
'session.data_dir': '/var/tmp/beaker'
}
# Raven Sentry configuration
raven_dsn = config.get('debug', 'sentry_dsn')
# Email notification configuration
email_notification = config.getboolean('email', 'notification')
email_prefix = config.get('email', 'prefix')
smtp_host = config.get('email', 'smtp_host')
smtp_port = config.getint('email', 'smtp_port')
email_from = config.get('email', 'from')
email_to = config.get('email', 'to').split()
# Use long traceback with xtraceback
use_long_trace = config.getboolean('debug', 'use_long_trace')
# Ask Mandaye to auto decompress a response message
# Decompress response only if you load a filter
auto_decompress = config.getboolean('mandaye', 'auto_decompress')
# Ask mandaye to add a toolbar with Mandaye's links
mandaye_toolbar = config.getboolean('mandaye', 'toolbar')
# Authentic 2 auto connection
a2_auto_connection = config.getboolean('mandaye', 'a2_auto_connection')
# Choose storage
# Only mandaye.backends.sql at the moment
storage_backend = "mandaye.backends.sql"
if config.get('mandaye', 'storage_backend') == 'sql':
storage_backend = "mandaye.backends.sql"
else:
ImproperlyConfigured('Storage backend must be sql')
# Encrypt service provider passwords with a secret
# You should install pycypto to use this feature
encrypt_sp_password = config.getboolean('mandaye', 'encrypt_sp_password')
# Must be a 15, 24, or 32 bytes long
encrypt_secret = config.get('mandaye', 'encrypt_secret')
session_type = config.get('session', 'type')
if session_type not in ('file', 'dbm', 'memory', 'memcached'):
raise ImproperlyConfigured('Sesssion type %r not supported' % session_type)
if session_type == 'memcached':
session_type = 'ext:memcached'
# Beaker session configuration
session_opts = {
'session.type': session_type,
'session.url': config.get('session', 'url'),
'session.cookie_expires': config.getboolean('session', 'cookie_expires'),
'session.timeout': config.getint('session', 'timeout'),
'session.data_dir': config.get('session', 'data_dir')
}
# Import local config
try:
from local_config import *
from cam.local_config import *
except ImportError, e:
if 'local_config' in e.args[0]:
pass
if not 'local_config' in e.args[0]:
raise ImproperlyConfigured('Error while importing "local_config.py"')

View File

@ -0,0 +1,50 @@
[DEFAULT]
base_dir: .
[database]
; http://docs.sqlalchemy.org/en/rel_0_8/core/engines.html
url: sqlite:///%(base_dir)s/mandaye_cud.db
[dirs]
config_root: %(base_dir)s/conf.d
data_dir: %(base_dir)s/data
static_root: %(base_dir)s/mandaye_cud/static
static_url: /mandaye/static
templates_directories:
[debug]
debug: false
use_long_trace: true
log_debug: false
; you need to install python-raven for this feature
sentry_dsn:
[mandaye]
toolbar: true
a2_auto_connection: false
; only sql at the moment
storage_backend: sql
auto_decompress: true
; if you want to encypt password set to true
; you need to install pycrypto for this feature
encrypt_sp_password: false
; if encrypt_sp_password then you need to choose a secret
; must be a 16, 24, or 32 bytes long
encrypt_secret:
[session]
; file, dbm, memory or memcached
; if memcached you need to install python-memcached and memcached
type: memcached
url: 127.0.0.1:11211
cookie_expires: true
timeout: 3600
data_dir: %(base_dir)s/data
[email]
notification: false
prefix: [Mandaye CAM]
smtp_host: localhost
smtp_port: 25
from: traceback@entrouvert.com
to: admin+mandaye-mandaye_cud@entrouvert.com

View File

@ -35,6 +35,7 @@ form_values = {
urls = {
'associate_url': '/mandaye/associate',
'connection_url': '/mandaye/sso',
'disassociate_url': '/mandaye/disassociate',
'login_url': '/mandaye/login'
}
@ -42,24 +43,20 @@ mapping = [
{
'path': r'/mandaye/login$',
'method': 'GET',
'response': [{
'response': {
'auth': 'login',
'condition': 'response.code==302',
},]
'values': {'condition': 'response.code==302'},
},
},
{
'path': r'/mandaye/sso$',
'method': 'GET',
'response': [{
'auth': 'sso',
}]
'response': {'auth': 'sso',}
},
{
'path': r'/mandaye/slo$',
'method': 'GET',
'response': [{
'auth': 'slo',
}]
'response': {'auth': 'slo',}
},
{
'path': r'/mandaye/associate$',
@ -78,31 +75,25 @@ mapping = [
{
'path': r'/mandaye/associate$',
'method': 'POST',
'response': [
{
'auth': 'associate_submit',
'condition': "response.code==302"
},
]
'response': {
'auth': 'associate_submit',
'values': {'condition': "response.code==302"}
},
},
{
'path': r'%s$' % END_POINTS_PATH['single_sign_on_post'],
'method': 'POST',
'response': [{'auth': 'single_sign_on_post'}]
'response': {'auth': 'single_sign_on_post'}
},
{
'path': r'%s$' % END_POINTS_PATH['single_logout'],
'method': 'GET',
'response': [{
'auth': 'single_logout',
}]
'response': {'auth': 'single_logout',}
},
{
'path': r'%s$' % END_POINTS_PATH['single_logout_return'],
'method': 'GET',
'response': [{
'auth': 'single_logout_return',
}]
'response': {'auth': 'single_logout_return',}
},
]

View File

@ -1,498 +0,0 @@
/* theme derived and inspired by TerraFirma
* <http://www.oswd.org/design/information/id/3557/>
*/
html, body {
margin: 0;
font-family: sans-serif;
font-size: 12px;
}
body#iframe {
background: white;
}
html {
background: #F9F9F7 url(../images/a1.gif) repeat-x;
color: #44b2cb;
}
a
{
color: #44b2cb;
text-decoration: underline;
}
a:hover
{
text-decoration: none;
}
div#wrap {
background: white;
width: 640px;
margin: 5em auto;
padding: 15px;
-moz-border-radius: 6px;
-webkit-border-radius:6px;
-moz-box-shadow: 0 0 4px rgba(0,0,0,0.75);
-webkit-box-shadow: 0 0 4px rgba(0,0,0,0.75);
position: relative;
}
#header
{
position: absolute;
background: url(../images/a8.png) repeat-x;
-moz-border-radius: 6px 0 0 6px;
-webkit-border-radius: 6px 0 0 6px;
width: 450px;
height: 92px;
color: #fff;
padding-left: 20px;
}
#header h1
{
font-size: 23px;
letter-spacing: -1px;
padding-top: 30px;
margin: 0;
}
#header span
{
margin: 0;
font-size: 13px;
font-weight: normal;
color: #FCE2CA;
}
#splash
{
position: absolute;
right: 20px;
background: url(../images/eo.png) no-repeat;
width: 153px;
height: 92px;
-moz-border-radius: 0 6px 6px 0;
-webkit-border-radius: 0 6px 6px 0;
}
div#content {
margin: 1em 1ex;
margin-top: 130px;
padding: 1ex;
}
div#content h2 {
margin-top: 0;
font-weight: normal;
color: #656551;
font-size: 18px;
letter-spacing: -1px;
line-height: 25px;
margin-bottom: 20px;
padding: 0 0 10px 15px;
position: relative;
top: 4px;
background: url(../images/a22.gif) bottom repeat-x;
}
#footer
{
font-size: 70%;
position: relative;
clear: both;
height: 66px;
text-align: center;
line-height: 66px;
background-image: url(../images/a8.png);
color: #fff;
}
#footer a
{
color: #8C8C73;
}
form#login-form p {
float: left;
width: 40%;
}
form#login-form input.submit {
float: right;
width: 18%;
margin-top: 30px;
}
div.login-actions {
clear: both;
padding-top: 1em;
}
div.login-actions p {
margin: 0;
}
form p {
margin: 0 0 1em 0;
}
form p label {
display: block;
}
form p input,
form p textarea {
margin-left: 10px;
}
ul.messages {
margin: 0;
padding: 0;
list-style: none;
}
ul.messages li.error {
color: #e80404;
}
ul.errorlist {
margin: 0;
padding: 0;
color: #e80404;
list-style: none;
}
input, textarea {
padding: 5px;
border: 1px solid #cccccc;
color:#666666;
background: white;
color: black;
}
textarea:focus, input[type="text"]:focus, input[type="password"]:focus {
border: 1px solid #4690d6;
color:#333333;
}
input[type=submit] {
color: #ffffff;
background:#4690d6;
border: 1px solid #2a567f;
font-weight: bold;
padding: 2px 8px 2px 8px;
margin: 0;
cursor: pointer;
}
input[type=submit]:hover {
border-color: #0e1d2b;
}
form#login-form ul.errorlist {
margin-bottom: 1em;
width: 80%;
font-weight: normal;
}
/* OpenID Stuff */
#openid_btns, #openid_btns br {
clear: both;
}
#openid_highlight a {
border: 1px solid #888;
}
#openid_input_area input[type=submit] {
padding-top: 0;
margin-top: 0;
margin-left: 1em;
}
.openid_large_btn {
width: 100px;
height: 60px;
border: 1px solid #DDD;
margin: 3px;
float: left;
}
.openid_small_btn {
width: 24px;
height: 24px;
border: 1px solid #DDD;
margin: 3px;
float: left;
}
a.openid_large_btn:focus {
outline: none;
}
a.openid_large_btn:focus {
-moz-outline-style: none;
}
.openid_selected {
border: 4px solid #DDD;
}
#openid_input_area {
clear: both;
padding-top: 2.5em;
}
li.indented {
margin-left: 50px;
}
ul.NoBullet {
list-style-type: none;
}
div#content h4 {
margin-bottom: 5px;
margin-top: 30px;
}
div#content p {
margin-top: 0;
}
div.errors {
margin: 0;
padding: 0;
color: #e80404;
list-style: none;
}
div#breadcrumb {
font-size: 80%;
margin-bottom: 1em;
}
div#user {
position: absolute;
top: 115px;
right: 12px;
}
a#logout {
font-size: 100%;
}
.ui-tabs .ui-tabs-hide {
display: none;
}
h4 {
padding-left: 0.5em;
}
h4 + div, div#profile {
padding-left: 1em;
}
div#menu {
position: relative;
background: #46461F url(../images/a17.gif) repeat-x;
height: 67px;
padding: 0px 20px 0px 5px;
margin: 136px 0px 0px 0px;
}
#menu ul
{
padding: 0;
margin: 0;
}
#menu ul li
{
display: inline;
line-height: 52px;
padding-left: 3px;
}
#menu ul li.first
{
border-left: 0px;
}
#menu ul li a
{
background-color: transparent;
background-repeat: repeat-x;
padding: 8px 12px 8px 12px;
font-size: 12px;
color: #fff;
font-weight: bold;
}
#menu ul li a:hover
{
background: #fff url(../images/a18.gif) repeat-x top;
color: #4A4A24;
text-decoration: none;
}
#eo
{
position: absolute;
top: 0px;
line-height: 52px;
color: #BDBDA2;
right: 30px;
font-weight: bold;
font-size: 12px;
letter-spacing: -1px;
}
#eo a {
color: inherit;
text-decoration: none;
}
ul#tab-nav {
list-style: none;
padding: 0;
width: 160px;
float: left;
}
ul#tab-nav li {
line-height: 300%;
position: relative;
right: -1px;
border: 1px solid transparent;
}
ul#tab-nav li.ui-tabs-selected {
border: 1px solid #ccc;
border-right: 1px solid white;
}
ul#tab-nav a {
display: block;
padding-left: 1ex;
outline: none;
-moz-user-focus:ignore;
}
ul#tab-nav a:hover {
}
ul#tab-nav a:active {
}
/* XXX: add a class to divs, so it works in IE */
div#tabs > div {
border: 1px solid #ccc;
float: left;
width: 420px;
padding: 10px;
min-height: 26em;
}
a.bigbutton {
display: block;
-moz-border-radius: 6px;
-webkit-border-radius:6px;
border: 1px solid black;
margin: 2em 0;
line-height: 300%;
text-align: center;
text-decoration: none;
font-weight: bold;
-webkit-box-shadow: 0 0 4px rgba(0,0,0,0.75);
-moz-box-shadow: 0 0 4px rgba(0,0,0,0.75);
}
a.bigbutton:hover {
background: #eee;
}
div#providers {
display: none;
}
#modalOverlay {
height:100%;
width:100%;
position:fixed;
left:0;
top:0;
z-index:3000;
background-color: rgba(0, 0, 0, 0.8);
cursor:wait;
}
div#popup {
display: none;
position:fixed;
width:500px;
left:50%;
margin-left:-250px;
z-index:3100;
top: 10%;
}
div#popup div {
position: relative;
margin: 0;
background: white;
border: 1px solid black;
border-color: #333 black black #333;
}
div#popup h2 {
text-align: center;
}
div#popup ul {
max-height: 70px;
overflow: auto;
margin: 0 1em 1em 1em;
padding: 0 1em 1em 1em;
}
div#popup h3 {
margin-bottom: 4px;
padding-left: 10px;
}
div#popup p {
margin: 5px;
}
div#popup a#close {
float: right;
padding: 1ex;
}
a.roleid_button {
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
background: #5C5C5C;
color: #44b2cb;
font-weight: bold;
padding-top: 5px;
padding-bottom: 5px;
padding-right: 10px;
padding-left: 10px;
margin: 0;
cursor: pointer;
text-decoration: none;
}
a.roleid_button:hover {
background: black;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 407 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 781 B

View File

View File

@ -7,9 +7,17 @@ from beaker.middleware import SessionMiddleware
from whitenoise import WhiteNoise
from mandaye_cud import config
import mandaye
from mandaye.server import MandayeApp
# production
application = SessionMiddleware(MandayeApp(), config.session_opts)
application_dev = WhiteNoise(application, root=config.static_root, prefix=config.static_url)
# development
mandaye_path = os.path.dirname(mandaye.__file__)
application_dev = WhiteNoise(application,
root=os.path.join(mandaye_path, 'static'),
prefix=config.static_url)
application_dev.add_files(config.static_root, prefix=config.static_url)