Creating users

From Protege Wiki
Revision as of 13:02, March 13, 2008 by TaniaTudorache (talk | contribs) (Creating users programmatically in client-server mode)

Jump to: navigation, search

Creating 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