mirror of
				https://github.com/laurivosandi/certidude
				synced 2025-10-31 01:19:11 +00:00 
			
		
		
		
	Add more API tests for lease, attribs etc
This commit is contained in:
		| @@ -222,4 +222,7 @@ def certidude_app(): | ||||
|     # Bootstrap resource | ||||
|     app.add_route("/api/bootstrap/", BootstrapResource()) | ||||
|  | ||||
|     # Add sink for serving static files | ||||
|     app.add_sink(StaticResource(os.path.join(__file__, "..", "..", "static"))) | ||||
|  | ||||
|     return app | ||||
|   | ||||
| @@ -18,11 +18,14 @@ class LeaseDetailResource(object): | ||||
|     @login_required | ||||
|     @authorize_admin | ||||
|     def on_get(self, req, resp, cn): | ||||
|         path, buf, cert = authority.get_signed(cn) | ||||
|         return dict( | ||||
|             last_seen = xattr.getxattr(path, "user.lease.last_seen"), | ||||
|             address = xattr.getxattr(path, "user.lease.address").decode("ascii") | ||||
|         ) | ||||
|         try: | ||||
|             path, buf, cert = authority.get_signed(cn) | ||||
|             return dict( | ||||
|                 last_seen = xattr.getxattr(path, "user.lease.last_seen"), | ||||
|                 address = xattr.getxattr(path, "user.lease.address").decode("ascii") | ||||
|             ) | ||||
|         except EnvironmentError: # Certificate or attribute not found | ||||
|             raise falcon.HTTPNotFound() | ||||
|  | ||||
|  | ||||
| class LeaseResource(object): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user