mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-08 14:40:27 +00:00
spelling: privilege
This commit is contained in:
parent
aced23db97
commit
3c7da371d2
@ -440,7 +440,7 @@ class User(db.Model):
|
|||||||
|
|
||||||
def revoke_privilege(self):
|
def revoke_privilege(self):
|
||||||
"""
|
"""
|
||||||
Revoke all privielges from a user
|
Revoke all privileges from a user
|
||||||
"""
|
"""
|
||||||
user = User.query.filter(User.username == self.username).first()
|
user = User.query.filter(User.username == self.username).first()
|
||||||
|
|
||||||
@ -452,7 +452,7 @@ class User(db.Model):
|
|||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
db.session.rollback()
|
db.session.rollback()
|
||||||
logging.error('Cannot revoke user {0} privielges. DETAIL: {1}'.format(self.username, e))
|
logging.error('Cannot revoke user {0} privileges. DETAIL: {1}'.format(self.username, e))
|
||||||
return False
|
return False
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -603,7 +603,7 @@ class Account(db.Model):
|
|||||||
db.session.commit()
|
db.session.commit()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
db.session.rollback()
|
db.session.rollback()
|
||||||
logging.error('Cannot revoke user privielges on account {0}. DETAIL: {1}'.format(self.name, e))
|
logging.error('Cannot revoke user privileges on account {0}. DETAIL: {1}'.format(self.name, e))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for uid in added_ids:
|
for uid in added_ids:
|
||||||
@ -616,7 +616,7 @@ class Account(db.Model):
|
|||||||
|
|
||||||
def revoke_privileges_by_id(self, user_id):
|
def revoke_privileges_by_id(self, user_id):
|
||||||
"""
|
"""
|
||||||
Remove a single user from prigilege list based on user_id
|
Remove a single user from privilege list based on user_id
|
||||||
"""
|
"""
|
||||||
new_uids = [u for u in self.get_user() if u != user_id]
|
new_uids = [u for u in self.get_user() if u != user_id]
|
||||||
users = []
|
users = []
|
||||||
@ -635,7 +635,7 @@ class Account(db.Model):
|
|||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
db.session.rollback()
|
db.session.rollback()
|
||||||
logging.error('Cannot add user privielges on account {0}. DETAIL: {1}'.format(self.name, e))
|
logging.error('Cannot add user privileges on account {0}. DETAIL: {1}'.format(self.name, e))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def remove_user(self, user):
|
def remove_user(self, user):
|
||||||
@ -648,7 +648,7 @@ class Account(db.Model):
|
|||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
db.session.rollback()
|
db.session.rollback()
|
||||||
logging.error('Cannot revoke user privielges on account {0}. DETAIL: {1}'.format(self.name, e))
|
logging.error('Cannot revoke user privileges on account {0}. DETAIL: {1}'.format(self.name, e))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
@ -972,7 +972,7 @@ class Domain(db.Model):
|
|||||||
if 0 != len(domain_users):
|
if 0 != len(domain_users):
|
||||||
self.name = domain_reverse_name
|
self.name = domain_reverse_name
|
||||||
self.grant_privileges(domain_users)
|
self.grant_privileges(domain_users)
|
||||||
return {'status': 'ok', 'msg': 'New reverse lookup domain created with granted privilages'}
|
return {'status': 'ok', 'msg': 'New reverse lookup domain created with granted privileges'}
|
||||||
return {'status': 'ok', 'msg': 'New reverse lookup domain created without users'}
|
return {'status': 'ok', 'msg': 'New reverse lookup domain created without users'}
|
||||||
return {'status': 'ok', 'msg': 'Reverse lookup domain already exists'}
|
return {'status': 'ok', 'msg': 'Reverse lookup domain already exists'}
|
||||||
|
|
||||||
@ -1037,7 +1037,7 @@ class Domain(db.Model):
|
|||||||
db.session.commit()
|
db.session.commit()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
db.session.rollback()
|
db.session.rollback()
|
||||||
logging.error('Cannot revoke user privielges on domain {0}. DETAIL: {1}'.format(self.name, e))
|
logging.error('Cannot revoke user privileges on domain {0}. DETAIL: {1}'.format(self.name, e))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for uid in added_ids:
|
for uid in added_ids:
|
||||||
@ -1046,7 +1046,7 @@ class Domain(db.Model):
|
|||||||
db.session.commit()
|
db.session.commit()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
db.session.rollback()
|
db.session.rollback()
|
||||||
logging.error('Cannot grant user privielges to domain {0}. DETAIL: {1}'.format(self.name, e))
|
logging.error('Cannot grant user privileges to domain {0}. DETAIL: {1}'.format(self.name, e))
|
||||||
|
|
||||||
def update_from_master(self, domain_name):
|
def update_from_master(self, domain_name):
|
||||||
"""
|
"""
|
||||||
|
@ -104,7 +104,7 @@
|
|||||||
var info = "Are you sure you want to revoke all privileges for " + username + ". They will not able to access any domain.";
|
var info = "Are you sure you want to revoke all privileges for " + username + ". They will not able to access any domain.";
|
||||||
modal.find('.modal-body p').text(info);
|
modal.find('.modal-body p').text(info);
|
||||||
modal.find('#button_revoke_confirm').click(function() {
|
modal.find('#button_revoke_confirm').click(function() {
|
||||||
var postdata = {'action': 'revoke_user_privielges', 'data': username}
|
var postdata = {'action': 'revoke_user_privileges', 'data': username}
|
||||||
applyChanges(postdata, $SCRIPT_ROOT + '/admin/manageuser');
|
applyChanges(postdata, $SCRIPT_ROOT + '/admin/manageuser');
|
||||||
modal.modal('hide');
|
modal.modal('hide');
|
||||||
})
|
})
|
||||||
|
@ -700,7 +700,7 @@ def domain_management(domain_name):
|
|||||||
# username in right column
|
# username in right column
|
||||||
new_user_list = request.form.getlist('domain_multi_user[]')
|
new_user_list = request.form.getlist('domain_multi_user[]')
|
||||||
|
|
||||||
# grant/revoke user privielges
|
# grant/revoke user privileges
|
||||||
d = Domain(name=domain_name)
|
d = Domain(name=domain_name)
|
||||||
d.grant_privileges(new_user_list)
|
d.grant_privileges(new_user_list)
|
||||||
|
|
||||||
@ -1198,13 +1198,13 @@ def admin_manageuser():
|
|||||||
else:
|
else:
|
||||||
return make_response(jsonify( { 'status': 'error', 'msg': 'Cannot remove user.' } ), 500)
|
return make_response(jsonify( { 'status': 'error', 'msg': 'Cannot remove user.' } ), 500)
|
||||||
|
|
||||||
elif jdata['action'] == 'revoke_user_privielges':
|
elif jdata['action'] == 'revoke_user_privileges':
|
||||||
user = User(username=data)
|
user = User(username=data)
|
||||||
result = user.revoke_privilege()
|
result = user.revoke_privilege()
|
||||||
if result:
|
if result:
|
||||||
history = History(msg='Revoke {0} user privielges'.format(data), created_by=current_user.username)
|
history = History(msg='Revoke {0} user privileges'.format(data), created_by=current_user.username)
|
||||||
history.add()
|
history.add()
|
||||||
return make_response(jsonify( { 'status': 'ok', 'msg': 'Revoked user privielges.' } ), 200)
|
return make_response(jsonify( { 'status': 'ok', 'msg': 'Revoked user privileges.' } ), 200)
|
||||||
else:
|
else:
|
||||||
return make_response(jsonify( { 'status': 'error', 'msg': 'Cannot revoke user privilege.' } ), 500)
|
return make_response(jsonify( { 'status': 'error', 'msg': 'Cannot revoke user privilege.' } ), 500)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user