DomainHandler:

- initStruct: 
  - set column write permissions depending on superadmin status
  - add _can_edit and _can_delete (also depending on superadmin status)
- webformConfig(): reduce required permissions to 'admin'
- add beforestore() - aborts writing for non-superadmins
- delete: allow deletion only for superadmins

*.lang:
- new text 'no_delete_permissions'



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1718 a1433add-5e2c-0410-b055-b7f2511e0802
pull/2/head
Christian Boltz 10 years ago
parent 1edc38a798
commit a4085d287f

@ -15,6 +15,7 @@ $PALANG['cancel'] = 'Отказ';
$PALANG['save'] = 'Запази'; # XXX Text change: "Save" -> "Save Changes"
$PALANG['confirm'] = 'Сигурни ли сте, че желаете да изтрието това?\n';
$PALANG['confirm_domain'] = 'Наистина ли искате да изтриете всички записи за този домейн? Това действие е необратимо!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Check for update';
$PALANG['invalid_parameter'] = 'Невалиден параметър!'; # XXX
$PALANG['show'] = 'Show:'; # XXX

@ -14,6 +14,7 @@ $PALANG['cancel'] = 'Cancel'; # XXX
$PALANG['save'] = 'Save changes'; # XXX
$PALANG['confirm'] = '¿Segur que vols esborrar-lo?\n';
$PALANG['confirm_domain'] = 'Estas segur que vols borrar tots els registres d\'aquest domini? Això no podrà ser desfet!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Check for update';
$PALANG['invalid_parameter'] = 'Invalid parameter!'; # XXX
$PALANG['show'] = 'Show:'; # XXX

@ -14,6 +14,7 @@ $PALANG['cancel'] = 'Cancel'; # XXX
$PALANG['save'] = 'Save changes'; # XXX
$PALANG['confirm'] = '是否确定删除?\n';
$PALANG['confirm_domain'] = '你是否确定要删除该域中的所有记录? 删除后不可恢复!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = '检查新版本';
$PALANG['invalid_parameter'] = 'Invalid parameter!'; # XXX
$PALANG['show'] = 'Show:'; # XXX

@ -18,6 +18,7 @@ $PALANG['cancel'] = 'Zrušit';
$PALANG['save'] = 'Uložit'; # XXX Text change: "Save" -> "Save changes"
$PALANG['confirm'] = 'Jste si jistí?\n';
$PALANG['confirm_domain'] = 'Opravdu chcete smazat všechny záznamy v této doméně Tohle nelze vrátit!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Zkontrolovat aktualizace';
$PALANG['invalid_parameter'] = 'Neplatný parametr!';
$PALANG['show'] = 'Show:'; # XXX

@ -17,6 +17,7 @@ $PALANG['cancel'] = 'Annuller';
$PALANG['save'] = 'Gem'; # XXX Text change: "Save" -> "Save changes"
$PALANG['confirm'] = 'Er du sikker på du vil slette dette?\n';
$PALANG['confirm_domain'] = 'Vil du virkelig slette alle adresser for dette domæne? Dette kan ikke fortrydes!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Søg efter opdateringer';
$PALANG['invalid_parameter'] = 'Ugyldig parameter.';
$PALANG['show'] = 'Show:'; # XXX

@ -15,6 +15,7 @@ $PALANG['cancel'] = 'Abbrechen';
$PALANG['save'] = 'Änderungen speichern';
$PALANG['confirm'] = 'Sind Sie sicher dass Sie das löschen wollen?\n';
$PALANG['confirm_domain'] = 'Wollen Sie wirklich alle Einträge dieser Domain löschen? Dies kann NICHT rückgängig gemacht werden!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Auf Updates überprüfen';
$PALANG['invalid_parameter'] = 'Ungültiger Parameter!';
$PALANG['show'] = 'Anzeigen:';

@ -15,6 +15,7 @@ $PALANG['cancel'] = 'Cancel';
$PALANG['save'] = 'Save changes';
$PALANG['confirm'] = 'Are you sure you want to delete this?\n';
$PALANG['confirm_domain'] = 'Do you really want to delete all records for this domain? This can not be undone!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!';
$PALANG['check_update'] = 'Check for update';
$PALANG['invalid_parameter'] = 'Invalid parameter!';
$PALANG['show'] = 'Show:';

@ -15,6 +15,7 @@ $PALANG['cancel'] = 'Cancelar';
$PALANG['save'] = 'Salvar'; # XXX Text change: "Save" -> "Save changes"
$PALANG['confirm'] = '¿Está seguro de que desea borrarlo?\n';
$PALANG['confirm_domain'] = '¿Está seguro de que desea borrar todos los registros de este dominio? ¡Esto no puede ser deshecho!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Check for update'; # XXX
$PALANG['invalid_parameter'] = '¡Parámetro inválido!';
$PALANG['show'] = 'Show:'; # XXX

@ -14,6 +14,7 @@ $PALANG['cancel'] = 'Cancel'; # XXX
$PALANG['save'] = 'Save changes'; # XXX
$PALANG['confirm'] = 'Oled kindel, et soovid seda kustutada?\n';
$PALANG['confirm_domain'] = 'Oled tõesti kindel, et tahad kustutada kõik kirjed sellele domeenile? Seda tegevust ei saa tagasi võtta!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Check for update'; # XXX
$PALANG['invalid_parameter'] = 'Invalid parameter!'; # XXX
$PALANG['show'] = 'Show:'; # XXX

@ -14,6 +14,7 @@ $PALANG['cancel'] = 'Cancel'; # XXX
$PALANG['save'] = 'Save changes'; # XXX
$PALANG['confirm'] = 'Ziur al zaude ezabatu nahi duzula?\n';
$PALANG['confirm_domain'] = 'Ziur al zaude domeinu honetako erregistro guztiak ezbatu nahi dituzula? Hau ezin izango da desegin!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Check for update';
$PALANG['invalid_parameter'] = 'Invalid parameter!'; # XXX
$PALANG['show'] = 'Show:'; # XXX

@ -15,6 +15,7 @@ $PALANG['cancel'] = 'Peruuta';
$PALANG['save'] = 'Tallenna'; # XXX Text change: "Save" -> "Save changes"
$PALANG['confirm'] = 'Oletko varma että haluat poistaa tämän?\n';
$PALANG['confirm_domain'] = 'Oletko varma että haluat poistaa kaikki tietueet tästä domainista? Tätä komentoa ei voi perua!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Tarkista päivitykset';
$PALANG['invalid_parameter'] = 'Viallinen parametri!';
$PALANG['show'] = 'Show:'; # XXX

@ -14,6 +14,7 @@ $PALANG['cancel'] = 'Cancel'; # XXX
$PALANG['save'] = 'Save changes'; # XXX
$PALANG['confirm'] = 'Ert tú vís(ur) í at tú vilt strika hetta?\n';
$PALANG['confirm_domain'] = 'Vilt tú veruliga strika allar upplýsingar fyri hetta navnaøki? Her kann ikki vendast aftur!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Check for update'; # XXX
$PALANG['invalid_parameter'] = 'Invalid parameter!'; # XXX
$PALANG['show'] = 'Show:'; # XXX

@ -16,6 +16,7 @@ $PALANG['cancel'] = 'Annuler';
$PALANG['save'] = 'Enregistrer les modifications';
$PALANG['confirm'] = 'Etes vous sur de vouloir supprimer cet enregistrement\n';
$PALANG['confirm_domain'] = 'Etes-vous sur de vouloir effacer tous les enregistrements dans ce domaine ? Cette opération ne pourra pas être annulée.\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Vérifier les mises à jour';
$PALANG['invalid_parameter'] = 'Paramètres invalides!';
$PALANG['show'] = 'Afficher:';

@ -13,6 +13,7 @@ $PALANG['cancel'] = 'Cancel'; # XXX
$PALANG['save'] = 'Save changes'; # XXX
$PALANG['confirm'] = 'Da li ste sigurni da želite ovo pobrisati?\n';
$PALANG['confirm_domain'] = 'Da li ste sigurni da želite pobrisati sve zapise za tu domenu? Zapisi ce biti zauvijek pobrisani!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Provjeri da li postoji novija inačica';
$PALANG['invalid_parameter'] = 'Invalid parameter!'; # XXX
$PALANG['show'] = 'Show:'; # XXX

@ -14,6 +14,7 @@ $PALANG['cancel'] = 'Cancel'; # XXX
$PALANG['save'] = 'Save changes'; # XXX
$PALANG['confirm'] = 'Biztos vagy benne hogy törlöd ezt?\n';
$PALANG['confirm_domain'] = 'Biztos hogy törölni akarod az összes bejegyzést ez alól a domain alól? Nem lehet visszahozni késõbb!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Check for update'; # XXX
$PALANG['invalid_parameter'] = 'Invalid parameter!'; # XXX
$PALANG['show'] = 'Show:'; # XXX

@ -14,6 +14,7 @@ $PALANG['cancel'] = 'Cancel'; # XXX
$PALANG['save'] = 'Save changes'; # XXX
$PALANG['confirm'] = 'Ertu viss um að þú viljir eyða þessu?\n';
$PALANG['confirm_domain'] = 'Ertu viss um að þú viljir eyða öllu sem tengist þessu léni? Það er ekki hægt að bakka með aðgerðina!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Check for update'; # XXX
$PALANG['invalid_parameter'] = 'Invalid parameter!'; # XXX
$PALANG['show'] = 'Show:'; # XXX

@ -15,6 +15,7 @@ $PALANG['cancel'] = 'Annulla';
$PALANG['save'] = 'registra'; # XXX Text change: "Save" -> "Save changes"
$PALANG['confirm'] = 'Sei certo di volerlo cancellare?\n';
$PALANG['confirm_domain'] = 'Sei sicuro di voler cancellare tutti gli indirizzi di questo dominio? Questa modifica sarà permanente!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Verifica gli aggiornamenti';
$PALANG['invalid_parameter'] = 'Parametro non valido!';
$PALANG['show'] = 'Show:'; # XXX

@ -15,6 +15,7 @@ $PALANG['cancel'] = 'キャンセル';
$PALANG['save'] = '変更を保存';
$PALANG['confirm'] = '本当に削除してもよろしいですか?\n';
$PALANG['confirm_domain'] = '本当にこのドメインのすべての情報を削除してもよろしいですか?これを元に戻すことはできません。\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = '更新の確認';
$PALANG['invalid_parameter'] = '無効なパラメータです。';
$PALANG['show'] = '閲覧:';

@ -14,6 +14,7 @@ $PALANG['cancel'] = 'Atšaukti';
$PALANG['save'] = 'Išsaugoti';
$PALANG['confirm'] = 'Tikrai norite šalinti?\n';
$PALANG['confirm_domain'] = 'Tikrai norite šalinti visus šios srities įrašus? Operacija negrįžtama!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Patikrinti versiją';
$PALANG['invalid_parameter'] = 'Neteisingas parametras!';
$PALANG['show'] = 'Rodyti:';

@ -14,6 +14,7 @@ $PALANG['cancel'] = 'Cancel'; # XXX
$PALANG['save'] = 'Save changes'; # XXX
$PALANG['confirm'] = 'Дали сте сигурни дека сакате да го избришете ова?\n';
$PALANG['confirm_domain'] = 'Дали сакате да ги избришете сите записи од овој домен? Ова не може да се поправи покасно!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Check for update'; # XXX
$PALANG['invalid_parameter'] = 'Invalid parameter!'; # XXX
$PALANG['show'] = 'Show:'; # XXX

@ -16,6 +16,7 @@ $PALANG['cancel'] = 'Avbryt';
$PALANG['save'] = 'Lagre'; # XXX Text change: "Save" -> "Save changes"
$PALANG['confirm'] = 'Er du sikker på at du ønsker å slette dette?\n';
$PALANG['confirm_domain'] = 'Ønsker du virkelig å slette alle oppføringer for dette domenet? Dette kan ikke angres!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Se etter oppdatering';
$PALANG['invalid_parameter'] = 'Ugyldig parameter!';
$PALANG['show'] = 'Show:'; # XXX

@ -15,6 +15,7 @@ $PALANG['cancel'] = 'Annuleren';
$PALANG['save'] = 'Wijzigingen opslaan';
$PALANG['confirm'] = 'Weet u het zeker dat u wilt verwijderen?\n';
$PALANG['confirm_domain'] = 'Weet u zeker dat u ALLE data van het domein wilt verwijderen? Dit kan niet ongedaan worden gemaakt!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Zoeken naar nieuwe versie';
$PALANG['invalid_parameter'] = 'ongeldige parameter!';
$PALANG['show'] = 'Toon:';

@ -14,6 +14,7 @@ $PALANG['cancel'] = 'Cancel'; # XXX
$PALANG['save'] = 'Save changes'; # XXX
$PALANG['confirm'] = 'Vil du slette dette?\n';
$PALANG['confirm_domain'] = 'Vil du virkelig slette alle poster og domenet?\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Se etter oppdatering';
$PALANG['invalid_parameter'] = 'Invalid parameter!'; # XXX
$PALANG['show'] = 'Show:'; # XXX

@ -17,6 +17,7 @@ $PALANG['cancel'] = 'Anuluj';
$PALANG['save'] = 'Zapisz'; # XXX Text change: "Save" -> "Save changes"
$PALANG['confirm'] = 'Jesteś przekonany, że chcesz to usunąć?\n';
$PALANG['confirm_domain'] = 'Czy rzeczywiście chcesz usunąć wszystkie wpisy dla tej domeny? To jest proces nieodwracalny!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Sprawdź aktualizację';
$PALANG['invalid_parameter'] = 'Błędny parametr!';
$PALANG['show'] = 'Show:'; # XXX

@ -15,6 +15,7 @@ $PALANG['cancel'] = 'Cancelar';
$PALANG['save'] = 'Gravar'; # XXX Text change: "Save" -> "Save changes"
$PALANG['confirm'] = 'Tem certeza de que deseja remover?\n';
$PALANG['confirm_domain'] = 'Tem certeza de que deseja remover todos os registros deste domínio? Essa ação não pode ser desfeita!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Checar por atualização';
$PALANG['invalid_parameter'] = 'Parâmetro inválido!';
$PALANG['show'] = 'Show:'; # XXX

@ -16,6 +16,7 @@ $PALANG['cancel'] = 'Отменить';
$PALANG['save'] = 'Сохранить изменения';
$PALANG['confirm'] = 'Вы уверены, что хотите удалить это?\n';
$PALANG['confirm_domain'] = 'Вы действительно хотите удалить все настройки для домена? Это действие нельзя будет отменить!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Проверить обновление';
$PALANG['invalid_parameter'] = 'Некорректный параметр!';
$PALANG['show'] = 'Показать:';

@ -15,6 +15,7 @@ $PALANG['cancel'] = 'Zrušiť';
$PALANG['save'] = 'Uložiť'; # XXX Text change: "Save" -> "Save changes"
$PALANG['confirm'] = 'Ste si istí?\n';
$PALANG['confirm_domain'] = 'Naozaj chcete zmazať všetky záznamy v tejto doméne? Toto nie je možné vrátiť!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Skontrolovať aktualizácie';
$PALANG['invalid_parameter'] = 'Neplatný parameter!';
$PALANG['show'] = 'Show:'; # XXX

@ -14,6 +14,7 @@ $PALANG['cancel'] = 'Cancel'; # XXX
$PALANG['save'] = 'Save'; # XXX # XXX Text change: "Save" -> "Save changes"
$PALANG['confirm'] = 'Ali ste prepričani, da želite brisati?\n';
$PALANG['confirm_domain'] = 'Ali ste prepričani, da želite brisati vse zapise za to domeno? Zapisi bodo izgubljeni za vedno!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Preveri, če obstaja novejša različica';
$PALANG['invalid_parameter'] = 'Invalid parameter!'; # XXX
$PALANG['show'] = 'Show:'; # XXX

@ -16,6 +16,7 @@ $PALANG['cancel'] = 'Avbryt';
$PALANG['save'] = 'Spara'; # XXX Text change: "Save" -> "Save changes"
$PALANG['confirm'] = 'Är du säker på att du vill radera denna?\n';
$PALANG['confirm_domain'] = 'Vill du verkligen radera all data för denna domän? Kan ej ångras!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Senaste versionen?';
$PALANG['invalid_parameter'] = 'Felaktig parameter!';
$PALANG['show'] = 'Show:'; # XXX

@ -14,6 +14,7 @@ $PALANG['cancel'] = 'Cancel'; # XXX
$PALANG['save'] = 'Save changes'; # XXX
$PALANG['confirm'] = 'Bunu silmek istediðinizden emin misiniz?\n';
$PALANG['confirm_domain'] = 'Bu domain için tüm kayýtlarý silmek istediðinizden emin misiniz? Bu iþlem geri alýnamaz!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = 'Check for update'; # XXX
$PALANG['invalid_parameter'] = 'Invalid parameter!'; # XXX
$PALANG['show'] = 'Show:'; # XXX

@ -14,6 +14,7 @@ $PALANG['cancel'] = 'Cancel'; # XXX
$PALANG['save'] = 'Save changes'; # XXX
$PALANG['confirm'] = '是否確定刪除?\n';
$PALANG['confirm_domain'] = '你是否確定要刪除該網域中的所有記錄? 刪除後不可恢復!\n';
$PALANG['no_delete_permissions'] = 'You are not allowed to delete %s!'; # XXX
$PALANG['check_update'] = '檢查新版本';
$PALANG['invalid_parameter'] = 'Invalid parameter!'; # XXX
$PALANG['show'] = 'Show:'; # XXX

@ -30,9 +30,11 @@ class DomainHandler extends PFAHandler {
protected function initStruct() {
# TODO: shorter PALANG labels ;-)
$transp = Config::intbool('transport');
$quota = Config::intbool('quota');
$dom_q = Config::intbool('domain_quota');
$super = $this->is_superadmin;
$transp = min($super, Config::intbool('transport'));
$quota = min($super, Config::intbool('quota'));
$dom_q = min($super, Config::intbool('domain_quota'));
# NOTE: There are dependencies between alias_count, mailbox_count and total_quota.
# NOTE: If you disable "display in list" for one of them, the SQL query for the others might break.
@ -42,15 +44,15 @@ class DomainHandler extends PFAHandler {
# field name allow display in... type $PALANG label $PALANG description default / options / ...
# editing? form list
'domain' => pacol( $this->new, 1, 1, 'text', 'domain' , '' ),
'description' => pacol( 1, 1, 1, 'text', 'description' , '' ),
'aliases' => pacol( 1, 1, 1, 'num' , 'aliases' , 'pAdminEdit_domain_aliases_text' , Config::read('aliases') ),
'description' => pacol( $super, 1, 1, 'text', 'description' , '' ),
'aliases' => pacol( $super, $super, 1, 'num' , 'aliases' , 'pAdminEdit_domain_aliases_text' , Config::read('aliases') ),
'alias_count' => pacol( 0, 0, 1, 'vnum', '' , '' , '', '',
/*not_in_db*/ 0,
/*dont_write_to_db*/ 1,
/*select*/ 'coalesce(__alias_count,0) - coalesce(__mailbox_count,0) as alias_count',
/*extrafrom*/ 'left join ( select count(*) as __alias_count, domain as __alias_domain from ' . table_by_key('alias') .
' group by domain) as __alias on domain = __alias_domain'),
'mailboxes' => pacol( 1, 1, 1, 'num' , 'mailboxes' , 'pAdminEdit_domain_aliases_text' , Config::read('mailboxes') ),
'mailboxes' => pacol( $super, $super, 1, 'num' , 'mailboxes' , 'pAdminEdit_domain_aliases_text' , Config::read('mailboxes') ),
'mailbox_count' => pacol( 0, 0, 1, 'vnum', '' , '' , '', '',
/*not_in_db*/ 0,
/*dont_write_to_db*/ 1,
@ -65,11 +67,21 @@ class DomainHandler extends PFAHandler {
'quota' => pacol( $dom_q, $dom_q, $dom_q, 'num' , 'pAdminEdit_domain_quota' , 'pAdminEdit_domain_maxquota_text' , Config::read('domain_quota_default') ),
'transport' => pacol( $transp, $transp,$transp,'enum', 'transport' , 'pAdminEdit_domain_transport_text' , Config::read('transport_default') ,
/*options*/ Config::read('transport_options') ),
'backupmx' => pacol( 1, 1, 1, 'bool', 'pAdminEdit_domain_backupmx' , '' , 0),
'active' => pacol( 1, 1, 1, 'bool', 'active' , '' , 1 ),
'backupmx' => pacol( $super, $super, 1, 'bool', 'pAdminEdit_domain_backupmx' , '' , 0),
'active' => pacol( $super, $super, 1, 'bool', 'active' , '' , 1 ),
'default_aliases' => pacol( $this->new, $this->new, 0, 'bool', 'pAdminCreate_domain_defaultaliases', '' , 1,'', /*not in db*/ 1 ),
'created' => pacol( 0, 0, 1, 'ts', 'created' , '' ),
'modified' => pacol( 0, 0, 1, 'ts', 'last_modified' , '' ),
'_can_edit' => pacol( 0, 0, 1, 'int', '' , '' , 0 ,
/*options*/ '',
/*not_in_db*/ 0,
/*dont_write_to_db*/ 1,
/*select*/ $this->is_superadmin . ' as _can_edit' ),
'_can_delete' => pacol( 0, 0, 1, 'int', '' , '' , 0 ,
/*options*/ '',
/*not_in_db*/ 0,
/*dont_write_to_db*/ 1,
/*select*/ $this->is_superadmin . ' as _can_delete' ),
);
}
@ -95,12 +107,23 @@ class DomainHandler extends PFAHandler {
'create_button' => 'pAdminCreate_domain_button',
# various settings
'required_role' => 'global-admin',
'required_role' => 'admin',
'listview' => 'list-domain.php',
'early_init' => 0,
);
}
protected function beforestore() {
# TODO: is this function superfluous? _can_edit should already cover this
if ($this->is_superadmin) {
return true;
}
$this->errormsg[] = Config::Lang('edit_not_allowed', $this->id);
return false;
}
/**
* called by $this->store() after storing $this->values in the database
* can be used to update additional tables, call scripts etc.
@ -138,6 +161,12 @@ class DomainHandler extends PFAHandler {
* @return true on success false on failure
*/
public function delete() {
# TODO: check for _can_delete instead
if (! $this->is_superadmin) {
$this->errormsg[] = Config::Lang_f('no_delete_permissions', $this->id);
return false;
}
if ( ! $this->view() ) {
$this->errormsg[] = Config::Lang('domain_does_not_exist'); # TODO: can users hit this message at all? init() should already fail...
return false;

Loading…
Cancel
Save