2007-04-26 00:07:13 +04:00
|
|
|
# -*-python-*-
|
|
|
|
#
|
2013-01-04 23:01:54 +04:00
|
|
|
# Copyright (C) 2006-2013 The ViewCVS Group. All Rights Reserved.
|
2007-04-26 00:07:13 +04:00
|
|
|
#
|
|
|
|
# By using this file, you agree to the terms and conditions set forth in
|
|
|
|
# the LICENSE.html file which can be found at the top level of the ViewVC
|
|
|
|
# distribution or at http://viewvc.org/license-1.html.
|
|
|
|
#
|
|
|
|
# For more information, visit http://viewvc.org/
|
|
|
|
#
|
|
|
|
# -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
"""Generic API for implementing authorization checks employed by ViewVC."""
|
|
|
|
|
|
|
|
class GenericViewVCAuthorizer:
|
|
|
|
"""Abstract class encapsulating version control authorization routines."""
|
|
|
|
|
2008-02-06 22:22:53 +03:00
|
|
|
def __init__(self, username=None, params={}):
|
2007-04-26 00:07:13 +04:00
|
|
|
"""Create a GenericViewVCAuthorizer object which will be used to
|
|
|
|
validate that USERNAME has the permissions needed to view version
|
2008-02-06 22:22:53 +03:00
|
|
|
control repositories (in whole or in part). PARAMS is a
|
|
|
|
dictionary of custom parameters for the authorizer."""
|
2007-04-26 00:07:13 +04:00
|
|
|
pass
|
|
|
|
|
2008-02-06 22:22:53 +03:00
|
|
|
def check_root_access(self, rootname):
|
|
|
|
"""Return 1 iff the associated username is permitted to read ROOTNAME."""
|
|
|
|
pass
|
2010-12-09 19:10:04 +03:00
|
|
|
|
|
|
|
def check_universal_access(self, rootname):
|
|
|
|
"""Return 1 if the associated username is permitted to read every
|
|
|
|
path in the repository at every revision, 0 if the associated
|
|
|
|
username is prohibited from reading any path in the repository, or
|
|
|
|
None if no such determination can be made (perhaps because the
|
|
|
|
cost of making it is too great)."""
|
|
|
|
pass
|
|
|
|
|
2008-02-06 22:22:53 +03:00
|
|
|
def check_path_access(self, rootname, path_parts, pathtype, rev=None):
|
2007-04-26 00:07:13 +04:00
|
|
|
"""Return 1 iff the associated username is permitted to read
|
2008-02-06 22:22:53 +03:00
|
|
|
revision REV of the path PATH_PARTS (of type PATHTYPE) in
|
|
|
|
repository ROOTNAME."""
|
2007-04-26 00:07:13 +04:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
2013-07-18 20:02:34 +04:00
|
|
|
|
2007-04-26 00:07:13 +04:00
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
class ViewVCAuthorizer(GenericViewVCAuthorizer):
|
|
|
|
"""The uber-permissive authorizer."""
|
2008-02-06 22:22:53 +03:00
|
|
|
def check_root_access(self, rootname):
|
|
|
|
return 1
|
2010-12-09 19:10:04 +03:00
|
|
|
|
|
|
|
def check_universal_access(self, rootname):
|
|
|
|
return 1
|
2007-04-26 00:07:13 +04:00
|
|
|
|
2008-02-06 22:22:53 +03:00
|
|
|
def check_path_access(self, rootname, path_parts, pathtype, rev=None):
|
2007-04-26 00:07:13 +04:00
|
|
|
return 1
|