Commit 8140229e authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Interface handle 3 categories of user (None, user and admin).

New node CAS to deal with users, their groups, .....
Remove user action in the toolbox.
parent 3c076a00
......@@ -4,5 +4,8 @@
@auth.requires_login()
def index():
session.role = 'admin'
id_group = db.auth_membership(user_id=auth.user_id).group_id
session.role = db.auth_group(id=id_group).role
return LOAD('plugin_dbui', 'index', vars=request.vars)
......@@ -3,7 +3,7 @@
"""
def index():
session.role = 'user'
session.role = ''
return LOAD('plugin_dbui', 'index', vars=request.vars)
......
......@@ -10,30 +10,6 @@ from invenio_tools import MONTHS
from plugin_dbui import get_id
@auth.requires_login()
def authorise():
"""Authorise a register user.
The action is steered via the URL:
http://localhost:8000/track_publications/toolbox/authorise?id=4
"""
# get the user id
if 'id' not in request.vars:
return 'Specify the user id !!!'
id = request.vars.id
# change the registration key
db.auth_user[id] = dict(registration_key='')
# show the change
rows = db().select(db.auth_user.ALL)
return SQLTABLE(rows,
headers='labels',
renderstyle=True)
@auth.requires_login()
def export_csv():
"""export a table as csv file.
......@@ -209,14 +185,3 @@ def migrate_record():
msg.append('Publication ajoutée')
return '<br>'.join(msg)
@auth.requires_login()
def users():
"""Return the list of users and their status.
"""
rows = db().select(db.auth_user.ALL)
return SQLTABLE(rows,
headers='labels',
renderstyle=True)
\ No newline at end of file
......@@ -52,6 +52,7 @@
"can be applied on any field of the table using the where syntax. don't work with the foreign table (see smart_query in the web2py)": "can be applied on any field of the table using the where syntax. don't work with the foreign table (see smart_query in the web2py)",
"Can't access the MySQL database !!!": "La base de données MySQL n'est pas accesible !!!",
'Cannot be empty': 'Cannot be empty',
'CAS': 'CAS',
'categories': 'catégories',
'Categories': 'Catégories',
'Category': 'Catégorie',
......@@ -130,6 +131,7 @@
'First Author': 'Premier Auteur',
'First name': 'First name',
'Footer': 'Pied de page',
'Forgot username?': 'Forgot username?',
'forgot username?': 'forgot username?',
'Format': 'Format',
'Formattor': 'Formattor',
......@@ -137,6 +139,7 @@
'General': 'Général',
'Granularity': 'Granularité',
'Grids': 'Tables',
'Group': 'Groupe',
'Group %(group_id)s created': 'Group %(group_id)s created',
'Group ID': 'Group ID',
'Group uniquely assigned to user %(id)s': 'Group uniquely assigned to user %(id)s',
......@@ -369,6 +372,7 @@
'Url': 'Url',
'url': 'url',
'Use (...)&(...) for AND, (...)|(...) for OR, and ~(...) for NOT to build more complex queries.': 'Use (...)&(...) for AND, (...)|(...) for OR, and ~(...) for NOT to build more complex queries.',
'User': 'User',
'User %(id)s Logged-in': 'User %(id)s Logged-in',
'User %(id)s Logged-out': 'User %(id)s Logged-out',
'User %(id)s Password changed': 'User %(id)s Password changed',
......
......@@ -23,3 +23,17 @@ auth.settings.registration_requires_verification = False
auth.settings.registration_requires_approval = True
auth.settings.remember_me_form = False
auth.settings.reset_password_requires_verification = True
# tune authentification fields for the extJS interface
db.auth_user.registration_key.readable = True
db.auth_user.registration_key.writable = True
db.auth_membership.user_id.label = 'User'
db.auth_membership.group_id.label = 'Group'
db.auth_membership.user_id.requires = \
IS_IN_DB(db, 'auth_user.id', 'auth_user.last_name')
db.auth_membership.group_id.requires = \
IS_IN_DB(db, 'auth_group.id', 'auth_group.role')
......@@ -9,6 +9,24 @@ dbui.configure_grids(db, plugins=['pGridRowEditorConfirmDelete',
'pGridRowEditorContextMenu',
'pGridRowEditorDblClick',
'pGridExport'])
#
# auth_xxx grid
#
gridModifier = dbui.GridModifier('auth_group')
gridModifier.configure_column('role', width=15)
gridModifier.set_rownumbering()
gridModifier = dbui.GridModifier('auth_membership')
gridModifier.configure_column('user_id', width=20)
gridModifier.set_rownumbering()
gridModifier = dbui.GridModifier('auth_user')
gridModifier.configure_column('first_name', width=30)
gridModifier.configure_column('last_name', width=30)
gridModifier.hide_columns('password')
gridModifier.set_rownumbering()
#
# authors_roles grid
#
......
......@@ -25,6 +25,18 @@ configuration_tools_tables = ['axes',
main_tables = ['diplomas', 'publications']
#
# CAS node
#
if session.role == 'admin':
hidden_tables = list(db.tables)
for el in ('auth_user', 'auth_group', 'auth_membership'):
hidden_tables.remove(el)
casNode = dbui.Node(T('CAS'))
configurator = lambda tablename: dbui.to_gridPanel(db[tablename])
casNode.add_children(db.tables, func=configurator, hidden=hidden_tables)
#
# configuration tables node
......@@ -37,22 +49,21 @@ if session.role == 'admin':
confNode.add_children(db.tables, func=configurator, hidden=hidden_tables)
#
# Hidden tables for the remaining nodes
# core tables node
#
if session.role == 'admin':
hidden_tables = list(auth_tables)
hidden_tables.extend(configuration_tools_tables)
if session.role in ('admin', 'user'):
else:
hidden_tables = set(db.tables).difference(main_tables)
#
# core tables node
#
gridNode = dbui.Node(T('Tables'))
configurator = lambda tablename: dbui.to_gridPanel(db[tablename])
gridNode.add_children(db.tables, func=configurator, hidden=hidden_tables)
if session.role == 'admin':
hidden_tables = list(auth_tables)
hidden_tables.extend(configuration_tools_tables)
elif session.role == 'user':
hidden_tables = set(db.tables).difference(main_tables)
gridNode = dbui.Node(T('Tables'))
configurator = lambda tablename: dbui.to_gridPanel(db[tablename])
gridNode.add_children(db.tables, func=configurator, hidden=hidden_tables)
#
# help node
......@@ -87,38 +98,40 @@ reportNode.sort_children()
#
# wizard node
#
authorNode = dbui.to_panelWithUrlSelector(virtdb.authors_selector,
baseUrl=URL('wizards', 'extract_authors'))
freeNode = dbui.to_panelWithUrlSelector(virtdb.free_harvester_selector,
baseUrl=URL('harvest', 'free_run'),
timeout=3600)
checkNode = dbui.to_panelWithUrlSelector(virtdb.check_selector,
baseUrl=URL('wizards', 'check_validate'))
harvesterNode = dbui.to_panelWithUrlSelector(virtdb.harvester_selector,
baseUrl=URL('harvest', 'run'),
timeout=3600)
marc12Node = dbui.to_panelWithUrlSelector(virtdb.marc12_selector,
baseUrl=URL('harvest', 'insert_marcxml'))
runAllNode = dbui.to_panelWithUrlSelector(virtdb.run_all_harvesters_selector,
baseUrl=URL('harvest', 'run_all'),
timeout=3600)
wizardNode = dbui.Node(T('Wizards'))
wizardNode.add_child(T('insert MARCXML'), marc12Node)
if session.role == 'admin':
wizardNode.add_child(T('check and validate'), checkNode)
wizardNode.add_child(T('extract authors'), authorNode)
wizardNode.add_child(T('run a harvester'), harvesterNode)
if session.role in ('admin', 'user'):
authorNode = dbui.to_panelWithUrlSelector(virtdb.authors_selector,
baseUrl=URL('wizards', 'extract_authors'))
freeNode = dbui.to_panelWithUrlSelector(virtdb.free_harvester_selector,
baseUrl=URL('harvest', 'free_run'),
timeout=3600)
checkNode = dbui.to_panelWithUrlSelector(virtdb.check_selector,
baseUrl=URL('wizards', 'check_validate'))
harvesterNode = dbui.to_panelWithUrlSelector(virtdb.harvester_selector,
baseUrl=URL('harvest', 'run'),
timeout=3600)
marc12Node = dbui.to_panelWithUrlSelector(virtdb.marc12_selector,
baseUrl=URL('harvest', 'insert_marcxml'))
runAllNode = dbui.to_panelWithUrlSelector(virtdb.run_all_harvesters_selector,
baseUrl=URL('harvest', 'run_all'),
timeout=3600)
wizardNode = dbui.Node(T('Wizards'))
wizardNode.add_child(T('insert MARCXML'), marc12Node)
wizardNode.add_child(T('run a free harvester'), freeNode)
wizardNode.add_child(T('run all harvester'), runAllNode)
wizardNode.sort_children()
if session.role == 'admin':
wizardNode.add_child(T('check and validate'), checkNode)
wizardNode.add_child(T('extract authors'), authorNode)
wizardNode.add_child(T('run a harvester'), harvesterNode)
wizardNode.add_child(T('run all harvester'), runAllNode)
wizardNode.sort_children()
#
# The viewport with its navigation tree
......@@ -128,10 +141,14 @@ viewportModifier = dbui.ViewportModifier()
viewportModifier.append_plugins('pViewportLogin')
if session.role == 'admin':
viewportModifier.add_node(helpNode, wizardNode, confNode, gridNode, reportNode)
viewportModifier.add_node(helpNode, casNode, wizardNode, confNode, gridNode, reportNode)
viewportModifier.configure(logged=True)
else:
elif session.role == 'user':
viewportModifier.add_node(helpNode, wizardNode, gridNode, reportNode)
viewportModifier.configure(logged=False)
else:
viewportModifier.add_node(helpNode, reportNode)
viewportModifier.configure(logged=False)
\ No newline at end of file
......@@ -2,6 +2,9 @@
HEAD
- New node CAS to manage user and their group.
- User and interface handle 3 groups None, user and admin.
0.7.0 (Nov 2012)
- Migrate to plugin_dbui 0.4.9.7.
- Deploy the new class Selector.
......
......@@ -13,6 +13,8 @@
front of it. The order of the check fields can be modified using
for example drag and drop technique.
- Exploit the new inspirehep.net API when available.
- Exploit the definition of the axes in the form used to define
lists and metrics. It should relies on the linked combobox.
At the same time review the fields defining axis for list.
......@@ -35,9 +37,6 @@
Indentation between the different level of classification might be
defined by the user.
- add a controller user in the toolbox to show the list or users.
Add also a controller to authorize a newly registered user.
- Merge the diploma table with the publications table.
Add a new category PHD. Simplify the list and metric tables accordingly.
Add a wizard to insert PHD.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment