Debian Codegraph @

cas_server/management/commands/cas_clean_federate.py

raw
1 # -*- coding: utf-8 -*-
2 # This program is distributed in the hope that it will be useful, but WITHOUT
3 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
4 # FOR A PARTICULAR PURPOSE. See the GNU General Public License version 3 for
5 # more details.
6 #
7 # You should have received a copy of the GNU General Public License version 3
8 # along with this program; if not, write to the Free Software Foundation, Inc., 51
9 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
10 #
11 # (c) 2016-2020 Valentin Samir
12 from django.core.management.base import BaseCommand
13
14 from ... import models
15
16 import sys
17 if sys.version_info < (3, ):
18 from django.utils.translation import ugettext_lazy as _
19 else:
20 from django.utils.translation import gettext_lazy as _
21
22
23 class Command(BaseCommand):
24 args = ''
25 help = _(u"Clean old federated users")
26
27 def handle(self, *args, **options):
28 models.FederatedUser.clean_old_entries()
29 models.FederateSLO.clean_deleted_sessions()