Gestione degli utenti e dei ruoli
Imparate a creare e gestire utenti, assegnare ruoli e definire privilegi di accesso personalizzati in Neo4j.
Gestione degli utenti e dei ruoli è una lezione Neo4j Graph Database Fundamentals gratuita su CoddyKit. Questa è la lezione 1 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Neo4j Graph Database Fundamentals, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Neo4j Graph Database Fundamentals include 4 lezioni in totale.
Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.
Secure Your Graph Data
Welcome to securing your Neo4j database! Just like any valuable asset, your graph data needs protection.
This lesson introduces the essential steps to manage who can access and modify your Neo4j database.
Control Access to Your Data
Why bother with user management? Imagine a bank vault without proper access control – chaos!
- Security: Prevent unauthorized access.
- Accountability: Track who does what.
- Compliance: Meet regulatory requirements.
It's about making sure only the right people have the right permissions.
AuthN vs. AuthZ
These terms are often confused, but they're distinct:
- Authentication (AuthN): Who are you? This verifies a user's identity (e.g., username and password).
- Authorization (AuthZ): What can you do? This determines what actions an authenticated user is allowed to perform.
First, we prove who we are (AuthN), then the system decides what we can do (AuthZ).
Meet the Default Admin
When you first install Neo4j, a default administrative user named neo4j is created.
- It has full administrative privileges.
- The initial password is also
neo4j. - Important: Always change this default password immediately after installation for security!
This user is your entry point to managing the database.
Adding New Users
To add new individuals or applications to your database, you'll create new user accounts.
Each user needs a unique username and a strong password. This ensures proper authentication before any actions are taken.
Let's see how to do this using Cypher, Neo4j's query language.
Creating Users with Cypher
The CREATE USER command is straightforward. Remember to choose a secure password!
Try running this example in your Neo4j Browser or cypher-shell:
CREATE USER 'alice' SET PASSWORD 'securePassword123';Changing Passwords
Passwords should be changed regularly, and users might forget them. Neo4j provides commands to manage user passwords.
- Change your own password:
ALTER CURRENT USER SET PASSWORD 'newPassword'; - Change another user's password (admin only):
ALTER USER 'alice' SET PASSWORD 'anotherNewPass';
Always use strong, unique passwords!
What are Roles?
Roles are collections of privileges that can be assigned to users. Instead of giving individual permissions to each user, you assign them a role.
Neo4j comes with several built-in roles, such as:
admin: Full administrative access.architect: Can create/manage schema (nodes, relationships, properties).publisher: Can write data.reader: Can only read data.
This simplifies managing permissions across many users.
Granting Roles
Once you've created users and understand roles, the next step is to grant specific roles to users. A user can have multiple roles.
Use the GRANT ROLE command to assign roles. To remove a role, use REVOKE ROLE.
Let's grant our new user 'alice' the 'reader' role:
GRANT ROLE reader TO alice;Check Your Understanding
You've learned how to create users and assign roles. Let's test your knowledge!
Lesson Summary
Great job! In this lesson, we covered the fundamentals of user management and roles in Neo4j:
- The importance of authentication and authorization.
- How to create new users using
CREATE USER. - Managing user passwords with
ALTER USER. - Understanding built-in roles like
admin,reader, andpublisher. - Assigning roles to users with
GRANT ROLE.
This knowledge is crucial for securing your graph database! Next, we'll dive deeper into defining custom access privileges.
Domande Frequenti
La lezione «Gestione degli utenti e dei ruoli» è gratuita?
Sì — il testo completo di «Gestione degli utenti e dei ruoli» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Neo4j Graph Database Fundamentals, passa a CoddyKit PRO. Il corso Neo4j Graph Database Fundamentals include 4 lezioni in totale.
Cosa imparerò in «Gestione degli utenti e dei ruoli»?
Imparate a creare e gestire utenti, assegnare ruoli e definire privilegi di accesso personalizzati in Neo4j. Eserciti Neo4j Graph Database Fundamentals con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.
Ho bisogno di esperienza per iniziare Neo4j Graph Database Fundamentals?
Non è richiesta alcuna esperienza precedente. Neo4j Graph Database Fundamentals su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 1 di 4.
Quanto tempo richiede la lezione «Gestione degli utenti e dei ruoli»?
La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.
Posso scrivere ed eseguire codice in questa lezione Neo4j Graph Database Fundamentals?
Sì. Ogni lezione Neo4j Graph Database Fundamentals include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.
Tutte le lezioni di questo corso
- Gestione degli utenti e dei ruoli
- Autenticazione e autorizzazione
- Protezione della distribuzione Neo4j
- Controllo granulare degli accessi e auditing