Difference between revisions of "Creating users"

From Protege Wiki
Jump to: navigation, search
(Creating users programmatically in client-server mode)
(Creating users programmatically in client-server mode)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
== Creating users programmatically in client-server mode ==
+
== Adding and removing users programmatically in client-server mode ==
  
 
In client-server mode (multi-user mode), one can create a user/password programmatically with the following code:
 
In client-server mode (multi-user mode), one can create a user/password programmatically with the following code:

Revision as of 12:49, March 18, 2008

Adding and removing users programmatically in client-server mode

In client-server mode (multi-user mode), one can create a user/password programmatically with the following code:

try {
    server = (RemoteServer) Naming.lookup("//" + serverName + "/" + Server.getBoundName());

    //optional - check if the server allows the creation of new users
    //boolean allowsUserCreate = server.allowsCreateUsers();
    
    server.createUser(username, password);

    } catch (Exception e) {
        Log.getLogger().severe(Log.toString(e));
    }


After creating a new user, the server will automatically save the metaproject file.


Note: The server is configured by default not to allow the creation of new users in the UI (this does not apply to the programmatic access). To enable the creation of users in the UI, add in the protege.properties file from the Protege installation directory on the server the following line:

server.allow.create.users=false