1133 |
1133 |
def stat(**kwargs):
|
1134 |
1134 |
'''Extend action decorator to allow passing statistics related info.'''
|
1135 |
1135 |
filters = kwargs.pop('filters', [])
|
|
1136 |
kwargs['detail'] = False
|
1136 |
1137 |
decorator = action(**kwargs)
|
1137 |
1138 |
|
1138 |
1139 |
def wraps(func):
|
... | ... | |
1217 |
1218 |
'err': 0,
|
1218 |
1219 |
})
|
1219 |
1220 |
|
1220 |
|
@stat(detail=False, name=_('Login count by authentication type'), filters=('ou', 'service'))
|
|
1221 |
@stat(name=_('Login count by authentication type'), filters=('ou', 'service'))
|
1221 |
1222 |
def login(self, request):
|
1222 |
1223 |
return self.get_statistics(request, UserLogin, 'get_method_statistics')
|
1223 |
1224 |
|
1224 |
|
@stat(detail=False, name=_('Login count by service'))
|
|
1225 |
@stat(name=_('Login count by service'))
|
1225 |
1226 |
def service_login(self, request):
|
1226 |
1227 |
return self.get_statistics(request, UserLogin, 'get_service_statistics')
|
1227 |
1228 |
|
1228 |
|
@stat(detail=False, name=_('Login count by organizational unit'))
|
|
1229 |
@stat(name=_('Login count by organizational unit'))
|
1229 |
1230 |
def service_ou_login(self, request):
|
1230 |
1231 |
return self.get_statistics(request, UserLogin, 'get_service_ou_statistics')
|
1231 |
1232 |
|
1232 |
|
@stat(detail=False, name=_('Registration count by type'), filters=('ou', 'service'))
|
|
1233 |
@stat(name=_('Registration count by type'), filters=('ou', 'service'))
|
1233 |
1234 |
def registration(self, request):
|
1234 |
1235 |
return self.get_statistics(request, UserRegistration, 'get_method_statistics')
|
1235 |
1236 |
|
1236 |
|
@stat(detail=False, name=_('Registration count by service'))
|
|
1237 |
@stat(name=_('Registration count by service'))
|
1237 |
1238 |
def service_registration(self, request):
|
1238 |
1239 |
return self.get_statistics(request, UserRegistration, 'get_service_statistics')
|
1239 |
1240 |
|
1240 |
|
@stat(detail=False, name=_('Registration count by organizational unit'))
|
|
1241 |
@stat(name=_('Registration count by organizational unit'))
|
1241 |
1242 |
def service_ou_registration(self, request):
|
1242 |
1243 |
return self.get_statistics(request, UserRegistration, 'get_service_ou_statistics')
|
1243 |
1244 |
|
1244 |
|
-
|