qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r1534613 - in /qpid/trunk/qpid/cpp/src: qpid/acl/AclValidator.cpp qpid/broker/Broker.cpp qpid/broker/QueueSettings.cpp qpid/broker/QueueSettings.h tests/acl.py
Date Tue, 22 Oct 2013 12:24:40 GMT
Author: gsim
Date: Tue Oct 22 12:24:40 2013
New Revision: 1534613

URL: http://svn.apache.org/r1534613
Log:
QPID-5246: update ACL code to recognise self-destruct policy

Modified:
    qpid/trunk/qpid/cpp/src/qpid/acl/AclValidator.cpp
    qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp
    qpid/trunk/qpid/cpp/src/qpid/broker/QueueSettings.cpp
    qpid/trunk/qpid/cpp/src/qpid/broker/QueueSettings.h
    qpid/trunk/qpid/cpp/src/tests/acl.py

Modified: qpid/trunk/qpid/cpp/src/qpid/acl/AclValidator.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/acl/AclValidator.cpp?rev=1534613&r1=1534612&r2=1534613&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/acl/AclValidator.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/acl/AclValidator.cpp Tue Oct 22 12:24:40 2013
@@ -110,7 +110,7 @@ namespace acl {
                                     boost::shared_ptr<PropertyType>(
                                         new IntPropertyType(0,std::numeric_limits<int64_t>::max()))));
 
-        std::string policyTypes[] = {"ring", "ring_strict", "flow_to_disk", "reject"};
+        std::string policyTypes[] = {"ring", "self-destruct", "reject"};
         std::vector<std::string> v(policyTypes, policyTypes + sizeof(policyTypes) /
sizeof(std::string));
         validators.insert(Validator(acl::SPECPROP_POLICYTYPE,
                           boost::shared_ptr<PropertyType>(

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp?rev=1534613&r1=1534612&r2=1534613&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp Tue Oct 22 12:24:40 2013
@@ -1285,7 +1285,7 @@ std::pair<boost::shared_ptr<Queue>, bool
         params.insert(make_pair(acl::PROP_DURABLE, settings.durable ? _TRUE : _FALSE));
         params.insert(make_pair(acl::PROP_EXCLUSIVE, owner ? _TRUE : _FALSE));
         params.insert(make_pair(acl::PROP_AUTODELETE, settings.autodelete ? _TRUE : _FALSE));
-        params.insert(make_pair(acl::PROP_POLICYTYPE, settings.dropMessagesAtLimit ? "ring"
: "reject"));
+        params.insert(make_pair(acl::PROP_POLICYTYPE, settings.getLimitPolicy()));
         params.insert(make_pair(acl::PROP_MAXQUEUECOUNT, boost::lexical_cast<string>(settings.maxDepth.getCount())));
         params.insert(make_pair(acl::PROP_MAXQUEUESIZE, boost::lexical_cast<string>(settings.maxDepth.getSize())));
         params.insert(make_pair(acl::PROP_MAXFILECOUNT, boost::lexical_cast<string>(settings.maxFileCount)));
@@ -1338,7 +1338,7 @@ void Broker::deleteQueue(const std::stri
             params.insert(make_pair(acl::PROP_DURABLE, queue->isDurable() ? _TRUE : _FALSE));
             params.insert(make_pair(acl::PROP_EXCLUSIVE, queue->hasExclusiveOwner() ?
_TRUE : _FALSE));
             params.insert(make_pair(acl::PROP_AUTODELETE, queue->isAutoDelete() ? _TRUE
: _FALSE));
-            params.insert(make_pair(acl::PROP_POLICYTYPE, queue->getSettings().dropMessagesAtLimit
? "ring" : "reject"));
+            params.insert(make_pair(acl::PROP_POLICYTYPE, queue->getSettings().getLimitPolicy()));
 
             if (!acl->authorise(userId,acl::ACT_DELETE,acl::OBJ_QUEUE,name,&params)
)
                 throw framing::UnauthorizedAccessException(QPID_MSG("ACL denied queue delete
request from " << userId));

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/QueueSettings.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/QueueSettings.cpp?rev=1534613&r1=1534612&r2=1534613&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/QueueSettings.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/QueueSettings.cpp Tue Oct 22 12:24:40 2013
@@ -314,4 +314,10 @@ QueueSettings::Aliases::Aliases()
     insert(value_type("x-qpid-maximum-message-size", "qpid.alert_size"));
 }
 
+std::string QueueSettings::getLimitPolicy() const
+{
+    if (dropMessagesAtLimit) return POLICY_TYPE_RING;
+    else if (selfDestructAtLimit) return POLICY_TYPE_SELF_DESTRUCT;
+    else return POLICY_TYPE_REJECT;
+}
 }} // namespace qpid::broker

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/QueueSettings.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/QueueSettings.h?rev=1534613&r1=1534612&r2=1534613&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/QueueSettings.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/QueueSettings.h Tue Oct 22 12:24:40 2013
@@ -111,6 +111,7 @@ struct QueueSettings
     QPID_BROKER_EXTERN void populate(const std::map<std::string, qpid::types::Variant>&
inputs, std::map<std::string, qpid::types::Variant>& unused);
     QPID_BROKER_EXTERN void populate(const qpid::framing::FieldTable& inputs, qpid::framing::FieldTable&
unused);
     QPID_BROKER_EXTERN std::map<std::string, qpid::types::Variant> asMap() const;
+    std::string getLimitPolicy() const;
 
     struct Aliases : std::map<std::string, std::string>
     {

Modified: qpid/trunk/qpid/cpp/src/tests/acl.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/acl.py?rev=1534613&r1=1534612&r2=1534613&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/acl.py (original)
+++ qpid/trunk/qpid/cpp/src/tests/acl.py Tue Oct 22 12:24:40 2013
@@ -382,8 +382,7 @@ class ACLTests(TestBase010):
         aclf.close()
 
         result = self.reload_acl()
-        expected = "ding is not a valid value for 'policytype', possible values are one of"
\
-                   " { 'ring' 'ring_strict' 'flow_to_disk' 'reject' }";
+        expected = "ding is not a valid value for 'policytype', possible values are one of"
         if (result.find(expected) == -1):
             self.fail(result)
 
@@ -802,6 +801,7 @@ class ACLTests(TestBase010):
         aclf.write('acl allow bob@QPID delete queue name=q4\n')
         aclf.write('acl allow bob@QPID create queue name=q5 maxqueuesize=1000 maxqueuecount=100\n')
         aclf.write('acl allow bob@QPID create queue name=q6 queuemaxsizelowerlimit=50 queuemaxsizeupperlimit=100
queuemaxcountlowerlimit=50 queuemaxcountupperlimit=100\n')
+        aclf.write('acl allow bob@QPID create queue name=q7 policytype=self-destruct\n')
         aclf.write('acl allow anonymous all all\n')
         aclf.write('acl deny all all')
         aclf.close()
@@ -915,6 +915,17 @@ class ACLTests(TestBase010):
                 self.fail("ACL should allow queue create request for q2 with exclusive=true
policytype=ring");
 
         try:
+            session.queue_declare(queue="q7", arguments={"qpid.policy_type": "ring"})
+            self.fail("ACL should not allow queue create request for q7 with policytype=ring");
+        except qpid.session.SessionException, e:
+            session = self.get_session('bob','bob')
+
+        try:
+            session.queue_declare(queue="q7", arguments={"qpid.policy_type": "self-destruct"})
+        except qpid.session.SessionException, e:
+            self.fail("ACL should allow queue create request for q7 with policytype=self-destruct");
+
+        try:
             session.queue_declare(queue="q3")
             session.queue_declare(queue="q4")
         except qpid.session.SessionException, e:



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message