display an error message when not allowed to delete something on the admin page

This commit is contained in:
Florian Schlichting 2016-12-30 16:25:53 +01:00
parent f24c62531a
commit fcace79813

View File

@ -74,6 +74,9 @@ function handle_subaction( $subaction ) {
return false;
}
}
else {
$c->messages[] = i18n('You are not allowed to delete collections for this principal.');
}
break;
case 'delete_principal':
@ -97,6 +100,9 @@ function handle_subaction( $subaction ) {
return false;
}
}
else {
$c->messages[] = i18n('You are not allowed to delete principals.');
}
break;
case 'delete_ticket':
@ -121,6 +127,9 @@ function handle_subaction( $subaction ) {
return false;
}
}
else {
$c->messages[] = i18n('You are not allowed to delete tickets for this principal.');
}
break;
case 'delete_bind_in':
@ -129,7 +138,7 @@ function handle_subaction( $subaction ) {
if ( $session->AllowedTo('Admin')
|| ($id > 0 && $session->principal_id == $id) ) {
if ( $session->CheckConfirmationHash('GET', 'confirm') ) {
dbg_error_log('admin-principal-edit',':handle_action: Allowed to delete ticket "%s" for principal %d', $_GET['bind_id'], $id );
dbg_error_log('admin-principal-edit',':handle_action: Allowed to delete binding "%s" for principal %d', $_GET['bind_id'], $id );
$qry = new AwlQuery('DELETE FROM dav_binding WHERE bind_id=?;', $_GET['bind_id'] );
if ( $qry->Exec() ) {
$c->messages[] = i18n('Binding deleted');
@ -151,6 +160,9 @@ function handle_subaction( $subaction ) {
return false;
}
}
else {
$c->messages[] = i18n('You are not allowed to delete bindings for this principal.');
}
break;
default: