mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-08-20 16:56:02 +00:00
Decide whether we can write the principal before we refer to it...
This commit is contained in:
parent
1cfc01758d
commit
ec3996bca7
@ -28,6 +28,12 @@ $privilege_xlate = array(
|
||||
'schedule-send' => translate('Scheduling: Sending')
|
||||
);
|
||||
|
||||
$can_write_principal = ($session->AllowedTo('Admin') || ($session->principal_id == $id));
|
||||
if ( !$can_write_principal && $id > 0 ) {
|
||||
$target_principal = new Principal('principal_id', $id);
|
||||
$can_write_principal = $session->HavePrivilegeTo('DAV::write', $target_principal->dav_name());
|
||||
}
|
||||
|
||||
|
||||
$delete_collection_confirmation_required = null;
|
||||
$delete_principal_confirmation_required = null;
|
||||
@ -943,10 +949,6 @@ if ( isset($_GET['subaction']) ) {
|
||||
$editor = principal_editor();
|
||||
$page_elements[] = $editor;
|
||||
|
||||
$principal_path = '/'.$editor->Value('username').'/';
|
||||
$can_write_principal = ($session->AllowedTo('Admin') || $session->principal_id == $id
|
||||
|| $session->HavePrivilegeTo('DAV::write', $principal_path) );
|
||||
|
||||
if ( isset($id) && $id > 0 ) {
|
||||
$c->stylesheets[] = 'css/browse.css';
|
||||
$c->scripts[] = 'js/browse.js';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user