Commit e0e716ca authored by Francesc Guasch's avatar Francesc Guasch
Browse files

fix(auth): remove auth on remove domain

issue #922
parent 0e4c4a75
......@@ -1152,10 +1152,10 @@ sub _after_remove_domain {
return if !$self->{_data};
$self->_finish_requests_db();
$self->_remove_base_db();
$self->_remove_access_attributes_db();
$self->_remove_domain_db();
}
# removes domain in other VMs
sub _remove_domain_cascade($self,$user, $cascade = 1) {
return if !$self->_vm;
......@@ -1178,6 +1178,14 @@ sub _remove_domain_cascade($self,$user, $cascade = 1) {
$sth->finish;
}
sub _remove_access_attributes_db($self) {
my $sth = $$CONNECTOR->dbh->prepare("DELETE FROM access_ldap_attribute"
." WHERE id_domain=?");
$sth->execute($self->id);
$sth->finish;
}
sub _remove_domain_db {
my $self = shift;
......@@ -3024,8 +3032,8 @@ Example:
sub allow_ldap_attribute($self, $attribute, $value, $allowed=1 ) {
my $sth = $$CONNECTOR->dbh->prepare(
"SELECT max(n_order) from access_ldap_attribute"
." WHERE id_domain = ? "
"SELECT max(n_order) FROM access_ldap_attribute "
." WHERE id_domain=?"
);
$sth->execute($self->id);
my ($n_order) = ($sth->fetchrow or 0);
......@@ -3033,9 +3041,9 @@ sub allow_ldap_attribute($self, $attribute, $value, $allowed=1 ) {
$sth = $$CONNECTOR->dbh->prepare(
"INSERT INTO access_ldap_attribute "
."(id_domain, attribute, value, allowed) "
."VALUES(?,?,?,?)");
$sth->execute($self->id, $attribute, $value, $allowed);
."(id_domain, attribute, value, allowed, n_order) "
."VALUES(?,?,?,?,?)");
$sth->execute($self->id, $attribute, $value, $allowed, $n_order+1);
}
=head2 deny_ldap_attribute
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment