Follow given steps to hide elements based in security groups:
- Add a groups attribute on <header> to hide it from other users:
...
<header groups="my_library.group_library_user">
...
- Add the groups attribute on the <menuitem> book category to display it only for librarian users:
<menuitem name="Book Categories"
id="library_book_category_menu"
parent="library_base_menu"
action="library_book_category_action"
groups="my_library.group_library_librarian"/>
Restart the server and update the module to apply the changes.