search: keywords: ['Java API', 'OServer', 'drop user', 'drop server user', 'dropUser']

OServer - dropUser()

This method removes a user from the OrientDB Server.

Removing Users

OrientDB differentiates between users with access to the server and users with access to the database. Occasionally, you may need to manage users on your server instances. This method allows you to remove them.

Syntax

public void OServer().dropUser(String iUser)
ArgumentTypeDescription
iUserjava.lang.StringDefines the user you want to remove

Exceptions

This method throws the following exception:

Example

Consider the use case of a web application. You may want to provide administrators and scripts access to manage server users, such as remove credentials when an administrator leaves the company.

In the class that manages your OServer instances, you might want a method to streamline this process and log the event for you.

/**
 * Remove OServer User
 */
public Boolean removeUser(OServer oserver, String user){

   // Log Operation
   logger.info("Removing User: " + user);

   try {

      // Remove USer
      oserver.dropUser(user);
	  return true;

   } catch(IOException err){

      // Report Exception
      logger.warn("Unable to Remove User: " +
	     err.getMessage());
      return false;
   }
}