mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-14 09:30:27 +00:00
Fix account deletion. Add more info in Account table
This commit is contained in:
parent
7da6bd5f99
commit
458826bc77
@ -558,7 +558,7 @@ class Account(db.Model):
|
|||||||
"""
|
"""
|
||||||
account = Account.query.filter(Account.name == self.name).first()
|
account = Account.query.filter(Account.name == self.name).first()
|
||||||
for domain in account.domains:
|
for domain in account.domains:
|
||||||
domain.assoc_account(None)
|
Domain(name=domain.name).assoc_account(None)
|
||||||
|
|
||||||
def create_account(self):
|
def create_account(self):
|
||||||
"""
|
"""
|
||||||
@ -664,6 +664,7 @@ class Account(db.Model):
|
|||||||
users.append(User(id=uid).get_user_info_by_id().username)
|
users.append(User(id=uid).get_user_info_by_id().username)
|
||||||
|
|
||||||
self.grant_privileges(users)
|
self.grant_privileges(users)
|
||||||
|
|
||||||
def add_user(self, user):
|
def add_user(self, user):
|
||||||
"""
|
"""
|
||||||
Add a single user to Account by User
|
Add a single user to Account by User
|
||||||
|
@ -36,6 +36,8 @@
|
|||||||
<th>Description</th>
|
<th>Description</th>
|
||||||
<th>Contact</th>
|
<th>Contact</th>
|
||||||
<th>Mail</th>
|
<th>Mail</th>
|
||||||
|
<th>Member</th>
|
||||||
|
<th>Domain</th>
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -46,6 +48,8 @@
|
|||||||
<td>{{ account.description }}</td>
|
<td>{{ account.description }}</td>
|
||||||
<td>{{ account.contact }}</td>
|
<td>{{ account.contact }}</td>
|
||||||
<td>{{ account.mail }}</td>
|
<td>{{ account.mail }}</td>
|
||||||
|
<td>{{ account.user_num }}</td>
|
||||||
|
<td>{{ account.domains|length }}</td>
|
||||||
<td width="15%">
|
<td width="15%">
|
||||||
<button type="button" class="btn btn-flat btn-success" onclick="window.location.href='{{ url_for('admin_editaccount', account_name=account.name) }}'">
|
<button type="button" class="btn btn-flat btn-success" onclick="window.location.href='{{ url_for('admin_editaccount', account_name=account.name) }}'">
|
||||||
Edit <i class="fa fa-cog"></i>
|
Edit <i class="fa fa-cog"></i>
|
||||||
|
@ -17,7 +17,7 @@ from flask import g, request, make_response, jsonify, render_template, session,
|
|||||||
from flask_login import login_user, logout_user, current_user, login_required
|
from flask_login import login_user, logout_user, current_user, login_required
|
||||||
from werkzeug import secure_filename
|
from werkzeug import secure_filename
|
||||||
|
|
||||||
from .models import User, Account, Domain, Record, Role, Server, History, Anonymous, Setting, DomainSetting, DomainTemplate, DomainTemplateRecord
|
from .models import User, Account, AccountUser, Domain, Record, Role, Server, History, Anonymous, Setting, DomainSetting, DomainTemplate, DomainTemplateRecord
|
||||||
from app import app, login_manager, csrf
|
from app import app, login_manager, csrf
|
||||||
from app.lib import utils
|
from app.lib import utils
|
||||||
from app.oauth import github_oauth, google_oauth, oidc_oauth
|
from app.oauth import github_oauth, google_oauth, oidc_oauth
|
||||||
@ -1344,6 +1344,8 @@ def admin_editaccount(account_name=None):
|
|||||||
def admin_manageaccount():
|
def admin_manageaccount():
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
accounts = Account.query.order_by(Account.name).all()
|
accounts = Account.query.order_by(Account.name).all()
|
||||||
|
for account in accounts:
|
||||||
|
account.user_num = AccountUser.query.filter(AccountUser.account_id==account.id).count()
|
||||||
return render_template('admin_manageaccount.html', accounts=accounts)
|
return render_template('admin_manageaccount.html', accounts=accounts)
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
Loading…
Reference in New Issue
Block a user