Page MenuHomec4science

webaccessadmin.py
No OneTemporary

File Metadata

Created
Fri, May 10, 22:03

webaccessadmin.py

## $Id$
##
## This file is part of the CERN Document Server Software (CDSware).
## Copyright (C) 2002, 2003, 2004, 2005 CERN.
##
## The CDSware is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## The CDSware is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with CDSware; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
"""CDSware WebAccess Administrator Interface."""
__lastupdated__ = """<: print `date +"%d %b %Y %H:%M:%S %Z"`; :>"""
import sys
import cdsware.webaccessadmin_lib as wal
# reload(wal)
# from cdsware.webaccessadmin_lib import index
__version__ = "$Id$"
index = wal.index
def rolearea(req):
"""create the role area menu page."""
return wal.perform_rolearea(req=req)
def actionarea(req):
"""create the role area menu page."""
return wal.perform_actionarea(req=req)
def userarea(req, email_user_pattern=''):
"""create the user area menu page. """
return wal.perform_userarea(req=req,
email_user_pattern=email_user_pattern)
def resetarea(req):
"""create the role area menu page."""
return wal.perform_resetarea(req=req)
def resetdefaultsettings(req, superusers=[], confirm=0):
"""create the reset default settings page. """
return wal.perform_resetdefaultsettings(req=req,
superusers=superusers,
confirm=confirm)
def adddefaultsettings(req, superusers=[], confirm=0):
"""create the add default settings page. """
return wal.perform_adddefaultsettings(req=req,
superusers=superusers,
confirm=confirm)
def manageaccounts(req, mtype='', content='', confirm=0):
"""enable, disable and edit accounts"""
return wal.perform_manageaccounts(req=req, mtype=mtype, content=content, confirm=confirm)
def modifyaccountstatus(req, userID, email_user_pattern='', limit_to=-1, maxpage=25, page=1, callback='yes', confirm=0):
"""enable or disable account"""
return wal.perform_modifyaccountstatus(req=req, userID=userID, email_user_pattern=email_user_pattern, limit_to=limit_to, maxpage=maxpage, page=page, callback=callback, confirm=confirm)
def modifypreferences(req, userID, login_method='', callback='yes', confirm=0):
"""modify the preferences of an account"""
return wal.perform_modifypreferences(req=req, userID=userID, login_method=login_method, callback=callback, confirm=confirm)
def modifylogindata(req, userID, email='', password='', callback='yes', confirm=0):
"""modify the email/password of an account"""
return wal.perform_modifylogindata(req=req, userID=userID, email=email, password=password, callback=callback, confirm=confirm)
def rejectaccount(req, userID, email_user_pattern='', limit_to=-1, maxpage=25, page=1, callback='yes', confirm=0):
"""Set account inactive, delete it and send email to the owner."""
return wal.perform_rejectaccount(req=req, userID=userID, email_user_pattern=email_user_pattern, limit_to=limit_to, maxpage=maxpage, page=page, callback=callback, confirm=confirm)
def deleteaccount(req, userID, callback='yes', confirm=0):
"""delete account"""
return wal.perform_deleteaccount(req=req, userID=userID, callback=callback, confirm=confirm)
def createaccount(req, email='', password='', callback='yes', confirm=0):
"""create account"""
return wal.perform_createaccount(req=req, email=email, password=password, callback=callback, confirm=confirm)
def editaccount(req, userID, mtype='', content='', callback='yes', confirm=0):
"""edit account. """
return wal.perform_editaccount(req=req, userID=userID, mtype=mtype, content=content, callback=callback, confirm=confirm)
def modifyaccounts(req, email_user_pattern='', limit_to=-1, maxpage=25, page=1, callback='yes', confirm=0):
"""Modify accounts. """
return wal.perform_modifyaccounts(req=req, email_user_pattern=email_user_pattern, limit_to=limit_to, maxpage=maxpage, page=page, callback=callback,confirm=confirm)
def delegate_startarea(req):
"""add info here"""
return wal.perform_delegate_startarea(req=req)
def delegate_adminsetup(req, id_role_admin=0, id_role_delegate=0, confirm=0):
"""add info here"""
return wal.perform_delegate_adminsetup(req=req,
id_role_admin=id_role_admin,
id_role_delegate=id_role_delegate,
confirm=confirm)
def delegate_adduserrole(req, id_role=0, email_user_pattern='', id_user=0, confirm=0):
"""add info here"""
return wal.perform_delegate_adduserrole(req=req,
id_role=id_role,
email_user_pattern=email_user_pattern,
id_user=id_user,
confirm=confirm)
def delegate_deleteuserrole(req, id_role=0, id_user=0, confirm=0):
"""add info here"""
return wal.perform_delegate_deleteuserrole(req=req,
id_role=id_role,
id_user=id_user,
confirm=confirm)
def addaction(req, name_action='', arguments='', optional='no', description='put description here.', confirm=0):
"""form to add a new action with these values:
name_action - name of the new action
arguments - allowedkeywords, separated by whitespace
description - optional description of the action"""
return wal.perform_addaction(req=req,
name_action=name_action,
arguments=arguments,
optional=optional,
description=description,
confirm=confirm)
def deleteaction(req, id_action="0", confirm=0):
"""show all roles connected, and ask for confirmation."""
return wal.perform_deleteaction(req=req,
id_action=id_action,
confirm=confirm)
def addrole(req, name_role='', description='put description here.', confirm=0):
"""form to add a new role with these values:
name_role - name of the new role
description - optional description of the role """
return wal.perform_addrole(req=req,
name_role=name_role,
description=description,
confirm=confirm)
def deleterole(req, id_role="0", confirm=0):
"""select a role and show all connected information,
users - users that can access the role.
actions - actions with possible authorizations."""
return wal.perform_deleterole(req=req,
id_role=id_role,
confirm=confirm)
def showroledetails(req, id_role='0'):
"""show the details of a role."""
return wal.perform_showroledetails(req=req,
id_role=id_role)
def showactiondetails(req, id_action="0"):
"""show the details of an action. """
return wal.perform_showactiondetails(req=req,
id_action=id_action)
def showuserdetails(req, id_user="0"):
"""show the details of an action. """
return wal.perform_showuserdetails(req=req,
id_user=id_user)
def adduserrole(req, id_role='0', email_user_pattern='', id_user='0', confirm=0):
"""create connection between user and role.
id_role - id of the role to add user to
email_user_pattern - search for users using this pattern
id_user - id of user to add to the role. """
return wal.perform_adduserrole(req=req,
id_role=id_role,
email_user_pattern=email_user_pattern,
id_user=id_user,
confirm=confirm)
def addroleuser(req, email_user_pattern='', id_user='0', id_role='0', confirm=0):
"""create connection between user and role.
email_user_pattern - search for users using this pattern
id_user - id of user to add to the role.
id_role - id of the role to add user to. """
return wal.perform_addroleuser(req=req,
email_user_pattern=email_user_pattern,
id_user=id_user,
id_role=id_role,
confirm=confirm)
def deleteuserrole(req, id_role='0', id_user='0', reverse=0, confirm=0):
"""delete connection between role and user.
id_role - id of role to disconnect
id_user - id of user to disconnect. """
return wal.perform_deleteuserrole(req=req,
id_role=id_role,
id_user=id_user,
reverse=reverse,
confirm=confirm)
def addauthorization(req, id_role="0", id_action="0", reverse="0", confirm=0, **keywords):
""" form to add new connection between user and role:
id_role - role to connect
id_action - action to connect
reverse - role or action first? """
return wal.perform_addauthorization(req=req,
id_role=id_role,
id_action=id_action,
reverse=reverse,
confirm=confirm,
**keywords)
def deleteroleaction(req, id_role="0", id_action="0", reverse=0, confirm=0):
"""delete all connections between a role and an action.
id_role - id of the role
id_action - id of the action
reverse - 0: ask for role first
1: ask for action first"""
return wal.perform_deleteroleaction(req=req,
id_role=id_role,
id_action=id_action,
reverse=reverse,
confirm=confirm)
def modifyauthorizations(req, id_role="0", id_action="0", reverse=0, confirm=0, sel='', errortext='', authids=[]):
"""given ids of a role and an action, show all possible action combinations
with checkboxes and allow user to access other functions.
id_role - id of the role
id_action - id of the action
reverse - 0: ask for role first
1: ask for action first
sel - which button and modification that is selected
errortext - text to print when no connection exist between role and action
authids - ids of checked checkboxes """
return wal.perform_modifyauthorizations(req=req,
id_role=id_role,
id_action=id_action,
reverse=reverse,
confirm=confirm,
sel=sel,
authids=authids)
def simpleauthorization(req, id_role=0, id_action=0):
"""show a page with simple overview of authorizations between a
connected role and action. """
return wal.perform_simpleauthorization(req=req,
id_role=id_role,
id_action=id_action)
def showroleusers(req, id_role=0):
"""show a page with simple overview of a role and connected users. """
return wal.perform_showroleusers(req=req,
id_role=id_role)

Event Timeline