def objectclasses(self):
return self._get_strings("objectClass")
+ @staticmethod
+ def _parse_date(s):
+ return datetime.datetime.strptime(s.decode(), "%Y%m%d%H%M%SZ")
+
class Accounts(Object):
def init(self):
return Account(self.backend, dn, attrs)
+ @staticmethod
+ def _format_date(t):
+ return t.strftime("%Y%m%d%H%M%SZ")
+
def get_created_after(self, ts):
- t = ts.strftime("%Y%m%d%H%M%SZ")
+ return self._search("(&(objectClass=person)(createTimestamp>=%s))" % self._format_date(ts))
- return self._search("(&(objectClass=person)(createTimestamp>=%s))" % t)
+ def count_created_after(self, ts):
+ return self._count("(&(objectClass=person)(createTimestamp>=%s))" % self._format_date(ts))
def search(self, query):
accounts = self._search("(&(objectClass=person)(|(cn=*%s*)(uid=*%s*)(displayName=*%s*)(mail=*%s*)))" \
return {}
- @staticmethod
- def _parse_date(s):
- return datetime.datetime.strptime(s.decode(), "%Y%m%d%H%M%SZ")
-
@property
def last_successful_authentication(self):
try:
<div class="row">
<div class="col-12 col-lg-3">
- <div class="card">
+ <div class="card mb-3">
<div class="card-body text-center">
<h1>{{ len(backend.accounts) }}</h1>
- <h5 class="mb-0">{{ _("Total Accounts") }}</h5>
+ <h5>{{ _("Total Accounts") }}</h5>
+
+ <hr>
+
+ {% set t = now - datetime.timedelta(days=7) %}
+
+ <h1>{{ backend.accounts.count_created_after(t) }}</h1>
+ <h5 class="mb-0">{{ _("Created This Week") }}</h5>
+
+ <hr>
+
+ {% set t = now - datetime.timedelta(days=30) %}
+
+ <h1>{{ backend.accounts.count_created_after(t) }}</h1>
+ <h5 class="mb-0">{{ _("Created This Month") }}</h5>
</div>
</div>
</div>