"Fossies" - the Fresh Open Source Software Archive

Member "viewvc-1.2.1/lib/vcauth/__init__.py" (26 Mar 2020, 2173 Bytes) of package /linux/misc/viewvc-1.2.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "__init__.py" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 1.1.28_vs_1.2.1.

    1 # -*-python-*-
    2 #
    3 # Copyright (C) 2006-2020 The ViewCVS Group. All Rights Reserved.
    4 #
    5 # By using this file, you agree to the terms and conditions set forth in
    6 # the LICENSE.html file which can be found at the top level of the ViewVC
    7 # distribution or at http://viewvc.org/license-1.html.
    8 #
    9 # For more information, visit http://viewvc.org/
   10 #
   11 # -----------------------------------------------------------------------
   12 
   13 """Generic API for implementing authorization checks employed by ViewVC."""
   14 
   15 class GenericViewVCAuthorizer:
   16   """Abstract class encapsulating version control authorization routines."""
   17   
   18   def __init__(self, root_lookup_func=None, username=None, params={}):
   19     """Create a GenericViewVCAuthorizer object which will be used to
   20     validate that USERNAME has the permissions needed to view version
   21     control repositories (in whole or in part).
   22 
   23     ROOT_LOOKUP_FUNC is a function that maps a root name to a 2-tuple
   24     containing the root's type and path.
   25 
   26     PARAMS is a dictionary of custom parameters for the authorizer."""
   27     pass
   28 
   29   def check_root_access(self, rootname):
   30     """Return 1 iff the associated username is permitted to read ROOTNAME."""
   31     pass
   32 
   33   def check_universal_access(self, rootname):
   34     """Return 1 if the associated username is permitted to read every
   35     path in the repository at every revision, 0 if the associated
   36     username is prohibited from reading any path in the repository, or
   37     None if no such determination can be made (perhaps because the
   38     cost of making it is too great)."""
   39     pass
   40     
   41   def check_path_access(self, rootname, path_parts, pathtype, rev=None):
   42     """Return 1 iff the associated username is permitted to read
   43     revision REV of the path PATH_PARTS (of type PATHTYPE) in
   44     repository ROOTNAME."""
   45     pass
   46 
   47 
   48 
   49 ##############################################################################
   50 
   51 class ViewVCAuthorizer(GenericViewVCAuthorizer):
   52   """The uber-permissive authorizer."""
   53   def check_root_access(self, rootname):
   54     return 1
   55 
   56   def check_universal_access(self, rootname):
   57     return 1
   58     
   59   def check_path_access(self, rootname, path_parts, pathtype, rev=None):
   60     return 1