Accès contributeur scopé sur leurs propres publications

This commit is contained in:
2026-05-28 18:02:14 +02:00
parent d8053ac82e
commit f93fe77a12
4 changed files with 211 additions and 51 deletions

View File

@@ -58,13 +58,31 @@ class Thalim_HAL_Importer {
}
public function add_admin_menu() {
add_management_page(
'HAL Import',
'HAL Import',
'edit_others_posts',
'thalim-hal-importer',
[$this, 'render_admin_page']
);
// Admins/editors : page sous Outils (UI complète : filtres tous auteurs, debug, etc.)
if (current_user_can('edit_others_posts')) {
add_management_page(
'HAL Import',
'HAL Import',
'edit_others_posts',
'thalim-hal-importer',
[$this, 'render_admin_page']
);
return;
}
// Contributeurs : menu top-level dédié (Outils est masqué pour eux par le thème).
// La classe rend une UI réduite scopée sur leur idHAL en interne.
if (current_user_can('edit_posts')) {
add_menu_page(
'Importer depuis HAL',
'Importer depuis HAL',
'edit_posts',
'thalim-hal-import-mine',
[$this, 'render_admin_page'],
'dashicons-download',
26
);
}
}
public function render_admin_page() {