Example #1
0
 def test_get_perms_anonymous(self):
     auth = UnixAuthorizer(
         global_perm='elr', anonymous_user=self.get_current_user())
     self.assertTrue('e' in auth.get_perms('anonymous'))
     self.assertFalse('w' in auth.get_perms('anonymous'))
     warnings.filterwarnings("ignore")
     auth.override_user('anonymous', perm='w')
     warnings.resetwarnings()
     self.assertTrue('w' in auth.get_perms('anonymous'))
Example #2
0
 def test_get_perms_anonymous(self):
     auth = UnixAuthorizer(global_perm='elr',
                           anonymous_user=self.get_current_user())
     self.assertTrue('e' in auth.get_perms('anonymous'))
     self.assertFalse('w' in auth.get_perms('anonymous'))
     warnings.filterwarnings("ignore")
     auth.override_user('anonymous', perm='w')
     warnings.resetwarnings()
     self.assertTrue('w' in auth.get_perms('anonymous'))
Example #3
0
def main():
    #authorizer = DummyAuthorizer()
    authorizer = UnixAuthorizer(rejected_users=["root"],
                                require_valid_shell=False)

    authorizer.override_user('bijan', homedir='/home/share')
    authorizer.override_user('yazdani', homedir='/home/share', perm='elradfmw')
    # authorizer.add_anonymous(homedir='/share/public')

    handler = MyHandler
    handler.authorizer = authorizer
    handler.use_send_file = True
    #handler.abstracted_fs = UnixFilesystem
    server = FTPServer(('', 2121), handler)
    #server = MultiprocessFTPServer(('', 2121), handler)
    server.serve_forever()