From 56e752193bfb90d11cfe73c35a24e576b9b18c87 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 03 Jul 2013 11:03:06 +0000
Subject: [PATCH] First stab at having debuggable ACIs.

---
 opends/src/server/org/opends/server/authorization/dseecompat/PermBindRulePair.java |   36 +++++++++++++++++++++++++++++-------
 1 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/opends/src/server/org/opends/server/authorization/dseecompat/PermBindRulePair.java b/opends/src/server/org/opends/server/authorization/dseecompat/PermBindRulePair.java
index f3621ea..7519ec9 100644
--- a/opends/src/server/org/opends/server/authorization/dseecompat/PermBindRulePair.java
+++ b/opends/src/server/org/opends/server/authorization/dseecompat/PermBindRulePair.java
@@ -23,8 +23,8 @@
  *
  *
  *      Copyright 2008 Sun Microsystems, Inc.
+ *      Portions Copyright 2013 ForgeRock AS
  */
-
 package org.opends.server.authorization.dseecompat;
 
 /**
@@ -33,14 +33,10 @@
  */
 public class PermBindRulePair {
 
-    /*
-     * The Bind Rule part.
-     */
+    /** The Bind Rule part. */
     private BindRule bindRule;
 
-    /*
-     * The permission part.
-     */
+    /** The permission part. */
     private Permission perm=null;
 
     /**
@@ -97,4 +93,30 @@
     public boolean hasRights(int right) {
         return perm.hasRights(right);
     }
+
+    /** {@inheritDoc} */
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder();
+        toString(sb);
+        return sb.toString();
+    }
+
+    /**
+     * Appends a string representation of this object to the provided buffer.
+     *
+     * @param buffer
+     *          The buffer into which a string representation of this object
+     *          should be appended.
+     */
+    public final void toString(StringBuilder buffer) {
+        if (this.perm != null) {
+            this.perm.toString(buffer);
+        }
+        buffer.append(" ");
+        if (this.bindRule != null) {
+            this.bindRule.toString(buffer);
+        }
+        buffer.append(")"); // not sure why, but we need this extra parenthesis
+    }
 }

--
Gitblit v1.10.0