mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-22 22:27:17 +00:00
chg: [cookiejars] show organisation
This commit is contained in:
parent
478f8f47d1
commit
8ab66e7309
3 changed files with 30 additions and 0 deletions
|
@ -501,12 +501,28 @@ def get_cookiejars_org(org_uuid):
|
||||||
cookiejars = []
|
cookiejars = []
|
||||||
return cookiejars
|
return cookiejars
|
||||||
|
|
||||||
|
def get_cookiejars_orgs():
|
||||||
|
cookiejars = []
|
||||||
|
for cookiejar_uuid in get_cookiejars():
|
||||||
|
cookiejar = Cookiejar(cookiejar_uuid)
|
||||||
|
if cookiejar.get_level() == 2:
|
||||||
|
cookiejars.append(cookiejar_uuid)
|
||||||
|
return cookiejars
|
||||||
|
|
||||||
def get_cookiejars_user(user_id):
|
def get_cookiejars_user(user_id):
|
||||||
cookiejars = r_crawler.smembers(f'cookiejars:user:{user_id}')
|
cookiejars = r_crawler.smembers(f'cookiejars:user:{user_id}')
|
||||||
if not cookiejars:
|
if not cookiejars:
|
||||||
cookiejars = []
|
cookiejars = []
|
||||||
return cookiejars
|
return cookiejars
|
||||||
|
|
||||||
|
def get_cookiejars_users():
|
||||||
|
cookiejars = []
|
||||||
|
for cookiejar_uuid in get_cookiejars():
|
||||||
|
cookiejar = Cookiejar(cookiejar_uuid)
|
||||||
|
if cookiejar.get_level() == 0:
|
||||||
|
cookiejars.append(cookiejar_uuid)
|
||||||
|
return cookiejars
|
||||||
|
|
||||||
class Cookiejar:
|
class Cookiejar:
|
||||||
|
|
||||||
def __init__(self, cookiejar_uuid):
|
def __init__(self, cookiejar_uuid):
|
||||||
|
@ -598,7 +614,9 @@ class Cookiejar:
|
||||||
meta = {'uuid': self.uuid,
|
meta = {'uuid': self.uuid,
|
||||||
'date': self.get_date(),
|
'date': self.get_date(),
|
||||||
'description': self.get_description(),
|
'description': self.get_description(),
|
||||||
|
'org': self.get_org(),
|
||||||
'user': self.get_user()}
|
'user': self.get_user()}
|
||||||
|
meta['org_name'] = ail_orgs.Organisation(meta['org']).get_name()
|
||||||
if level:
|
if level:
|
||||||
meta['level'] = self.get_level()
|
meta['level'] = self.get_level()
|
||||||
if nb_cookies:
|
if nb_cookies:
|
||||||
|
|
|
@ -718,6 +718,16 @@ def crawler_cookiejar_all():
|
||||||
return render_template("all_cookiejar.html", user_cookiejar=user_cookiejars,
|
return render_template("all_cookiejar.html", user_cookiejar=user_cookiejars,
|
||||||
org_cookiejar=org_cookiejars, global_cookiejar=global_cookiejars)
|
org_cookiejar=org_cookiejars, global_cookiejar=global_cookiejars)
|
||||||
|
|
||||||
|
@crawler_splash.route('/crawler/cookiejar/all/admin', methods=['GET'])
|
||||||
|
@login_required
|
||||||
|
@login_admin
|
||||||
|
def crawler_cookiejar_all_admin():
|
||||||
|
user_cookiejars = crawlers.get_cookiejars_meta_by_iterator(crawlers.get_cookiejars_users())
|
||||||
|
org_cookiejars = crawlers.get_cookiejars_meta_by_iterator(crawlers.get_cookiejars_orgs())
|
||||||
|
global_cookiejars = []
|
||||||
|
return render_template("all_cookiejar.html", user_cookiejar=user_cookiejars,
|
||||||
|
org_cookiejar=org_cookiejars, global_cookiejar=global_cookiejars)
|
||||||
|
|
||||||
|
|
||||||
@crawler_splash.route('/crawler/cookiejar/show', methods=['GET'])
|
@crawler_splash.route('/crawler/cookiejar/show', methods=['GET'])
|
||||||
@login_required
|
@login_required
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
<th class="bg-info text-white">Date</th>
|
<th class="bg-info text-white">Date</th>
|
||||||
<th class="bg-info text-white">UUID</th>
|
<th class="bg-info text-white">UUID</th>
|
||||||
<th class="bg-info text-white">Level</th>
|
<th class="bg-info text-white">Level</th>
|
||||||
|
<th class="bg-info text-white">Org</th>
|
||||||
<th class="bg-info text-white">User</th>
|
<th class="bg-info text-white">User</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -33,6 +34,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
<td>{{dict_cookiejar['org_name']}}<br>{{ dict_cookiejar['org'] }}</td>
|
||||||
<td>{{dict_cookiejar['user']}}</td>
|
<td>{{dict_cookiejar['user']}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Loading…
Reference in a new issue