mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

neil_a_wilson
09.51.2007 ed39262fa647434d4a0e31f07754a263ce2b16e3
opends/src/server/org/opends/server/tasks/BackupTask.java
@@ -22,13 +22,14 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 */
package org.opends.server.tasks;
import static org.opends.server.loggers.Debug.debugEnter;
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.core.DirectoryServer.getAttributeType;
import static org.opends.server.messages.TaskMessages.*;
import static org.opends.server.messages.ToolMessages.*;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.util.ServerConstants.DATE_FORMAT_UTC_TIME;
@@ -41,7 +42,9 @@
import org.opends.server.backends.task.TaskState;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.LockFileManager;
import org.opends.server.core.Operation;
import org.opends.server.api.Backend;
import org.opends.server.api.ClientConnection;
import org.opends.server.config.ConfigEntry;
import org.opends.server.config.ConfigException;
import org.opends.server.types.Attribute;
@@ -52,6 +55,8 @@
import org.opends.server.types.Entry;
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
import org.opends.server.types.Privilege;
import org.opends.server.types.ResultCode;
import java.util.ArrayList;
import java.util.Date;
@@ -104,7 +109,20 @@
    assert debugEnter(CLASS_NAME, "initializeTask");
    // FIXME -- Do we need any special authorization here?
    // If the client connection is available, then make sure the associated
    // client has the BACKEND_BACKUP privilege.
    Operation operation = getOperation();
    if (operation != null)
    {
      ClientConnection clientConnection = operation.getClientConnection();
      if (! clientConnection.hasPrivilege(Privilege.BACKEND_BACKUP, operation))
      {
        int    msgID   = MSGID_TASK_BACKUP_INSUFFICIENT_PRIVILEGES;
        String message = getMessage(msgID);
        throw new DirectoryException(ResultCode.INSUFFICIENT_ACCESS_RIGHTS,
                                     message, msgID);
      }
    }
    Entry taskEntry = getTaskEntry();