package edu.stanford.rt.credential; /** * @author Ninghui Li, Sandra Qiu
* * Implementation of SimpleDelegation element. * A DelegationRole has a required part delegateTo * and an optional part control. */ public class DelegationRole implements PrincipalExpression { /** * to whom to delegate the authority. */ private PrincipalExpression delegateTo; // required element. /** * depth of the allowed further delegation. */ private Role control; /** * Constructor for DelegationRole. */ public DelegationRole( PrincipalExpression delegateTo, Role control) { this.delegateTo = delegateTo; this.control = control; } /* (non-Javadoc) * @see edu.stanford.rt.credential.PrincipalExpression#toString(String) */ public String toString(String indent) { String thisIndent = indent + " "; StringBuffer sb = new StringBuffer(); sb.append(thisIndent).append("Delegation Role: \n"); sb.append(thisIndent + " ").append( delegateTo.toString()).append( "\n"); sb .append(thisIndent + " ") .append( (control == null) ? "" : control.toString(thisIndent + " ")) .append("\n"); return sb.toString(); } }