Changeset 5598

Show
Ignore:
Timestamp:
10/24/08 12:44:42 (3 months ago)
Author:
Gustavo
Message:

Added support for tgext.authorization, replacing tg.ext.repoze.who

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tg/commands/info.py

    r4559 r5598  
    1313"""#elements that not clear yet 
    1414    "TurboGears2 Extensions" : "turbogears2.extensions", 
    15     "Identity Providers" : "turbogears2.identity.provider", 
     15    "Auth Providers" : "turbogears2.auth.provider", 
    1616    "Visit Managers" : "turbogears2.visit.manager", 
    1717""" 
  • trunk/tg/configuration.py

    r5526 r5598  
    9797        """Creates some configuration defaults""" 
    9898 
    99         #Create a few bunches we know we'll use 
     99        # Create a few bunches we know we'll use 
    100100        self.paths = Bunch() 
    101101        self.render_functions = Bunch() 
     102        # And also very often... 
     103        self.sa_auth = Bunch() 
     104        self.sa_auth.translations = Bunch() 
    102105 
    103106        #Set individual defaults 
     
    155158 
    156159    def setup_sa_auth_backend(self): 
    157         defaults = {'users_table':'tg_user', 
    158                     'groups_table':'tg_group', 
    159                     'permissions_table':'tg_permission', 
    160                     'password_encryption_method':'sha1', 
     160        defaults = { 
    161161                    'form_plugin': None 
    162162                   } 
     
    287287    def add_auth_middleware(self, app): 
    288288        """Configure authorization/authentication""" 
    289         from tg.ext.repoze.who.middleware import make_who_middleware 
     289        from tgext.authorization.quickstart import setup_sql_auth 
    290290 
    291291        auth = self.sa_auth 
    292292 
    293         app = make_who_middleware(app, config, auth.user_class, 
    294                                   auth.user_criterion, 
    295                                   auth.user_id_column, 
    296                                   auth.dbsession, 
    297                                   ) 
     293        app = setup_sql_auth(app, config, auth.user_class, auth.group_class, 
     294                             auth.permission_class, auth.dbsession, 
     295                             translations=auth.translations) 
    298296        return app 
    299297 
  • trunk/tg/controllers.py

    r5519 r5598  
    408408            return obj, remainder 
    409409 
    410         # identity error should be treated separatly from "not found" errors 
     410        # auth error should be treated separatly from "not found" errors 
    411411        except HTTPUnauthorized, httpe: 
    412412            log.debug("a 401 error occured for obj: %s" % obj)