Back to index

nordugrid-arc-nox  1.1.0~rc6
security.cpp
Go to the documentation of this file.
00001 #ifdef HAVE_CONFIG_H
00002 #include <config.h>
00003 #endif
00004 
00005 #include "security.h"
00006 
00007 using namespace Arc;
00008 
00009 namespace ISIS {
00010 
00011 ISISSecAttr::ISISSecAttr(const std::string& action) {
00012   action_=action;
00013 }
00014 
00015 ISISSecAttr::~ISISSecAttr(void) {
00016 }
00017 
00018 ISISSecAttr::operator bool(void) const {
00019   return !action_.empty();
00020 }
00021 
00022 bool ISISSecAttr::equal(const SecAttr &b) const {
00023   try {
00024     const ISISSecAttr& a = (const ISISSecAttr&)b;
00025     return ((action_ == a.action_) && (context_ == a.context_));
00026   } catch(std::exception&) { };
00027   return false;
00028 }
00029 
00030 bool ISISSecAttr::Export(SecAttrFormat format,XMLNode &val) const {
00031   if(format == UNDEFINED) {
00032   } else if(format == ARCAuth) {
00033     NS ns;
00034     ns["ra"]="http://www.nordugrid.org/schemas/request-arc";
00035     val.Namespaces(ns); val.Name("ra:Request");
00036     XMLNode item = val.NewChild("ra:RequestItem");
00037     if(!action_.empty()) {
00038       XMLNode action = item.NewChild("ra:Action");
00039       action=action_;
00040       action.NewAttribute("Type")="string";
00041       action.NewAttribute("AttributeId")="http://www.nordugrid.org/schemas/policy-arc/types/isis/operation";
00042     };
00043     return true;
00044   } else {
00045   };
00046   return false;
00047 }
00048 
00049 } // namespace ISIS
00050