summaryrefslogtreecommitdiff
path: root/src/leap/bonafide/_decorators.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/bonafide/_decorators.py')
-rw-r--r--src/leap/bonafide/_decorators.py33
1 files changed, 0 insertions, 33 deletions
diff --git a/src/leap/bonafide/_decorators.py b/src/leap/bonafide/_decorators.py
deleted file mode 100644
index 6b43715..0000000
--- a/src/leap/bonafide/_decorators.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# -*- coding: utf-8 -*-
-# _decorators.py
-# Copyright (C) 2015 LEAP
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-"""
-Decorators used in bonafide.
-"""
-
-
-def auth_required(func):
- """
- Decorate a method so that it will not be called if the instance
- attribute `is_authenticated` does not evaluate to True.
- """
- def decorated(*args, **kwargs):
- instance = args[0]
- allowed = getattr(instance, 'is_authenticated')
- if not allowed:
- raise RuntimeError('This method requires authentication')
- return func(*args, **kwargs)
- return decorated