Commit 83f3f60a authored by Steven Murray's avatar Steven Murray
Browse files

WIP

parent c3029df9
......@@ -535,10 +535,11 @@ void castor::tape::tapeserver::daemon::CatalogueDrive::receivedLabelJob(
m_log,
m_netTimeout,
m_config,
m_processForker,
job,
labelCmdConnection,
m_cupv,
rmcPort,
labelCmdConnection);
m_processForker);
}
break;
default:
......
......@@ -33,10 +33,13 @@ castor::tape::tapeserver::daemon::CatalogueLabelSession *
log::Logger &log,
const int netTimeout,
const tape::utils::DriveConfig &driveConfig,
ProcessForkerProxy &processForker,
const castor::legacymsg::TapeLabelRqstMsgBody &labelJob,
const legacymsg::TapeLabelRqstMsgBody &labelJob,
const int labelCmdConnection,
legacymsg::CupvProxy &cupv,
const unsigned short rmcPort,
const int labelCmdConnection) {
ProcessForkerProxy &processForker) {
checkUserCanLabelTape(cupv, labelJob, labelCmdConnection);
const pid_t pid = processForker.forkLabel(driveConfig, labelJob, rmcPort);
......@@ -49,6 +52,24 @@ castor::tape::tapeserver::daemon::CatalogueLabelSession *
labelCmdConnection);
}
//------------------------------------------------------------------------------
// checkUserCanLabelTape
//------------------------------------------------------------------------------
void castor::tape::tapeserver::daemon::CatalogueLabelSession::
checkUserCanLabelTape(castor::legacymsg::CupvProxy &cupv,
const castor::legacymsg::TapeLabelRqstMsgBody &labelJob,
const int labelCmdConnection) {
/*
const bool userIsAdmin = cupv.isGranted(
labelJob.uid,
labelJob.gid,
m_vdqmJob.clientHost,
hostName,
P_ADMIN);
*/
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
......
......@@ -23,6 +23,7 @@
#pragma once
#include "castor/legacymsg/CupvProxy.hpp"
#include "castor/legacymsg/TapeLabelRqstMsgBody.hpp"
#include "castor/log/Logger.hpp"
#include "castor/tape/tapeserver/daemon/CatalogueSession.hpp"
......@@ -52,22 +53,24 @@ public:
* @param netTimeout Timeout in seconds to be used when performing network
* I/O.
* @param driveConfig The configuration of the tape drive.
* @param processForker Proxy object representing the ProcessForker.
* @param labelJob The label job received from the castor-tape-label
* command-line tool.
* @param rmcPort The TCP/IP port on which the rmcd daemon is listening.
* @param labelCmdConnection The file descriptor of the TCP/IP connection with
* the tape labeling command-line tool castor-tape-label.
* @param cupv Proxy object representing the cupvd daemon.
* @param rmcPort The TCP/IP port on which the rmcd daemon is listening.
* @param processForker Proxy object representing the ProcessForker.
* @return A newly created CatalogueSession object.
*/
static CatalogueLabelSession *create(
log::Logger &log,
const int netTimeout,
const tape::utils::DriveConfig &driveConfig,
ProcessForkerProxy &processForker,
const castor::legacymsg::TapeLabelRqstMsgBody &labelJob,
const int labelCmdConnection,
legacymsg::CupvProxy &cupv,
const unsigned short rmcPort,
const int labelCmdConnection);
ProcessForkerProxy &processForker);
/**
* Destructor.
......@@ -187,6 +190,24 @@ private:
*/
std::list<castor::exception::Exception> m_labelErrors;
/**
* Determines whether or not the user of the label session has the access
* rights to label the tape.
*
* This method throws a castor::exception::Exception if the user does not
* have the necessary access rights or there is an error which prevents this
* method for determining if they have such rights.
*
* @param cupv Proxy object representing the cupvd daemon.
* @param labelJob The label job received from the castor-tape-label
* command-line tool.
* @param labelCmdConnection The file descriptor of the TCP/IP connection with
* the tape labeling command-line tool castor-tape-label.
*/
static void checkUserCanLabelTape(legacymsg::CupvProxy &cupv,
const legacymsg::TapeLabelRqstMsgBody &labelJob,
const int labelCmdConnection);
}; // class CatalogueLabelSession
} // namespace daemon
......
......@@ -112,6 +112,8 @@ public:
* This method throws a castor::exception::Exception if the user does not
* have the necessary access rights or there is an error which prevents this
* method for determining if they have such rights.
*
* @param vid The volume identifier of the tape to be recalled from.
*/
void checkUserCanRecallFromTape(const std::string &vid);
......
......@@ -72,7 +72,6 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
log::Param("drive", m_request.drive),
log::Param("dgn", m_request.dgn)};
performPreMountChecks();
mountTape();
std::auto_ptr<castor::tape::tapeserver::drives::DriveInterface> drive =
getDriveObject();
......@@ -96,21 +95,6 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
}
}
//------------------------------------------------------------------------------
// performPreMountChecks
//------------------------------------------------------------------------------
void castor::tape::tapeserver::daemon::LabelSession::performPreMountChecks() {
checkClientIsOwnerOrAdmin();
}
//------------------------------------------------------------------------------
// checkClientIsOwnerOrAdmin
//------------------------------------------------------------------------------
void castor::tape::tapeserver::daemon::LabelSession::
checkClientIsOwnerOrAdmin() {
// TO BE DONE
}
//------------------------------------------------------------------------------
// getDriveObject
//------------------------------------------------------------------------------
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment