Changeset 2945

Show
Ignore:
Timestamp:
02/22/07 15:17:22 (2 years ago)
Author:
lekma
Message:

-implemented authentication
-some cleanups

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/lekma/README

    r2895 r2945  
    13134. and then run: /path/to/schevoz/usr/bin/schevoz -c /path/to/schevoz/etc/schevoz/schevoz.cfg 
    1414 
    15 there are some test script in the 'tests' folder, notably test_client_create.py 
    16 that creates a db remotly, and test_client.py test_client2.py to test concurrent 
    17 acces to a db. 
    18  
    1915please forgive the crudeness of the code, it is still an experiment :) 
  • sandbox/lekma/schevoz/usr/lib/schevoz/schemas/system/schema_001.py

    r2894 r2945  
    3838    # initial data 
    3939    _initial = [ 
    40         ("admin", "d033e22ae348aeb5660fc2140aec35850c4da997"), 
     40        ("admin", "c759eaf09e4638954f63ace0ce1b53b40f62ccb7"), 
    4141        ] 
    4242 
     
    5555    # initial data 
    5656    _initial = [ 
    57         ("system", ".system"), 
    5857        ("template", ".template"), 
    5958        ] 
     
    6968            db_file = "%s/Data.fs" % db_path 
    7069 
     70            # checking 
    7171            if os.path.isfile(db_file): 
    7272                raise Exception("a '%s' db already exists in '%s'." % (db_name, zeo_datadir)) 
     73            if db.Db.findone(name=db_name): 
     74                raise Exception("a '%s' db already exists in system db." % db_name) 
     75 
     76            # create the path if needed 
    7377            if not os.path.isdir(db_path): 
    7478                os.mkdir(db_path) 
    7579 
     80            # create the actual schevo db 
    7681            import schevoz.database 
    77             new_db = schevoz.database.open(db_file, schema_source) 
    78             new_db.close() 
     82            schevoz.database.open(db_file, schema_source).close() 
    7983 
     84            # update system db 
    8085            tx = db.Db.t.create() 
    8186            tx.name = db_name 
    8287            tx.path = db_name 
    83             db.execute(tx) 
     88            new_db = db.execute(tx) 
     89 
     90            # by default admin has access to all dbs (is this sound?) 
     91            tx2 = db.Access.t.create() 
     92            tx2.user = db.User[1] 
     93            tx2.db = new_db 
     94            db.execute(tx2) 
    8495 
    8596            return db_file 
     
    89100 
    90101 
     102class Access(E.Entity): 
     103 
     104    # fields 
     105    user = f.entity("User") 
     106    db = f.entity("Db") 
     107 
     108    # keys 
     109    _key(user, db) 
     110 
     111    # initial data 
     112    _initial = [ 
     113        (("admin", ), ("template", )), 
     114        ] 
    91115 
    92116 
    93117 
    94118 
    95  
    96  
    97  
    98  
    99  
    100  
    101  
    102  
    103  
    104  
    105  
    106  
    107  
    108  
    109  
    110  
    111  
    112  
    113  
    114  
    115  
    116  
    117  
    118  
    119  
    120  
  • sandbox/lekma/schevoz/usr/lib/schevoz/server.py

    r2894 r2945  
    1616from schevoz import config_defaults 
    1717from schevoz import database 
    18 from schevoz import zeo 
     18from schevoz.zeo import server 
    1919 
    2020 
     
    243243        # published dbs 
    244244        for db in self.sys_db.Db.find(): 
    245             if db.name != "system": 
    246                 db_uri = "%s/%s/Data.fs:%s" % (self._config.zeo_datadir, 
    247                                                db.path, db.name) 
    248                 self._db_uris.append(db_uri) 
     245            db_uri = "%s/%s/Data.fs:%s" % (self._config.zeo_datadir, 
     246                                            db.path, db.name) 
     247            self._db_uris.append(db_uri) 
    249248 
    250249 
     
    265264 
    266265        # intantiate the zeo  
    267         options = zeo.SchevoZEOOptions() 
     266        options = server.SchevoZEOOptions() 
    268267        options.realize(zeo_args) 
    269         self.zeo = zeo.SchevoZEOServer(options, self.sys_db) 
     268        self.zeo = server.SchevoZEOServer(options, self.sys_db) 
    270269         
    271270        # and start it