]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Make noise when AuthRequired used incorrectly
authorPatrick Nawracay <pnawracay@suse.com>
Tue, 15 May 2018 08:00:45 +0000 (10:00 +0200)
committerPatrick Nawracay <pnawracay@suse.com>
Fri, 15 Jun 2018 08:26:30 +0000 (10:26 +0200)
Don't fail silently when AuthRequired is used incorrectly, namely
without parentheses.

Signed-off-by: Patrick Nawracay <pnawracay@suse.com>
src/pybind/mgr/dashboard/controllers/__init__.py

index f42c22cc06fbff4615a09e023a911ad48e96b75e..c9e95ccdec8a7be31ebd728ce340af327ff27446 100644 (file)
@@ -70,6 +70,10 @@ class UiApiController(Controller):
 
 
 def AuthRequired(enabled=True):
+    if not isinstance(enabled, bool):
+        raise TypeError('AuthRequired used incorrectly. '
+                        'You are likely missing parentheses!')
+
     def decorate(cls):
         if not hasattr(cls, '_cp_config'):
             cls._cp_config = {