com.planet_ink.coffee_mud.core
Class CMSecurity.SecGroup

java.lang.Object
  extended by com.planet_ink.coffee_mud.core.CMSecurity.SecGroup
Enclosing class:
CMSecurity

public static class CMSecurity.SecGroup
extends java.lang.Object

Internal security class for a group of security flags, and which may also containing other groups.


Constructor Summary
CMSecurity.SecGroup(CMSecurity.SecFlag[] flags)
          Constructor from existing security flag data.
CMSecurity.SecGroup(java.lang.String name, java.util.Set<CMSecurity.SecFlag> flags)
          Constructor from existing security flag data.
CMSecurity.SecGroup(java.lang.String name, java.util.Set<CMSecurity.SecFlag> flags, java.util.List<CMSecurity.SecGroup> groups, java.util.List<CMSecurity.SecPath> paths, java.util.Set<java.lang.String> jFlags)
          Constructor from existing security flag data.
 
Method Summary
 boolean contains(CMSecurity.SecFlag flag, boolean isSubOp)
          Checks this group and all subgroups for access to the given security flag, also checking for subop (area) access if the isSubOp flag is sent.
 boolean containsAny(CMSecurity.SecGroup group, boolean isSubOp)
          Checks this group and all subgroups for access to any of the security flags or journal flags in the given group.
 boolean containsJournal(java.lang.String journalFlag)
          Checks the given group and all subgroups for access to a journal of the given name
 CMSecurity.SecGroup copyOf()
          Returns an exact copy of this object.
 java.util.Iterator<CMSecurity.SecFlag> flags()
          Returns an iterator through all the security flags that this group has access to, including all subgroups.
 java.lang.String getName()
          Returns the name of this security group.
 java.util.Iterator<CMSecurity.SecPath> paths()
          Returns an iterator of all file paths that this group has special access to, including those of subgroups.
 void reset(java.util.Set<CMSecurity.SecFlag> flags, java.util.List<CMSecurity.SecGroup> groups, java.util.List<CMSecurity.SecPath> paths, java.util.Set<java.lang.String> jFlags)
          Re-populates this group from new security flag data.
 int size()
          The number of all flags that this group was created with
 java.lang.String toString()
          Converts this object to a ; delimited string
 java.lang.String toString(char separatorChar)
          Converts this group object to a delimited string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CMSecurity.SecGroup

public CMSecurity.SecGroup(java.lang.String name,
                           java.util.Set<CMSecurity.SecFlag> flags,
                           java.util.List<CMSecurity.SecGroup> groups,
                           java.util.List<CMSecurity.SecPath> paths,
                           java.util.Set<java.lang.String> jFlags)
Constructor from existing security flag data.

Parameters:
name - the name of the group
flags - the basic security flags in this group
groups - other groups allowed by this group
paths - filesystem paths that this group grants access to
jFlags - names of journal that administrative rights are given to

CMSecurity.SecGroup

public CMSecurity.SecGroup(java.lang.String name,
                           java.util.Set<CMSecurity.SecFlag> flags)
Constructor from existing security flag data.

Parameters:
name - the name of the group
flags - the basic security flags in this group

CMSecurity.SecGroup

public CMSecurity.SecGroup(CMSecurity.SecFlag[] flags)
Constructor from existing security flag data.

Parameters:
flags - the basic security flags in this group
Method Detail

getName

public java.lang.String getName()
Returns the name of this security group.

Returns:
the name of this security group.

reset

public void reset(java.util.Set<CMSecurity.SecFlag> flags,
                  java.util.List<CMSecurity.SecGroup> groups,
                  java.util.List<CMSecurity.SecPath> paths,
                  java.util.Set<java.lang.String> jFlags)
Re-populates this group from new security flag data.

Parameters:
flags - the basic security flags in this group
groups - other groups allowed by this group
paths - filesystem paths that this group grants access to
jFlags - names of journal that administrative rights are given to

containsJournal

public boolean containsJournal(java.lang.String journalFlag)
Checks the given group and all subgroups for access to a journal of the given name

Parameters:
journalFlag - the name of the journal
Returns:
true if this group grants access, and false otherwise.

contains

public boolean contains(CMSecurity.SecFlag flag,
                        boolean isSubOp)
Checks this group and all subgroups for access to the given security flag, also checking for subop (area) access if the isSubOp flag is sent.

Parameters:
flag - the security flag to look for
isSubOp - true if this should also check for equivalent subop (area) flags
Returns:
true if this group contains the security, false otherwise

containsAny

public boolean containsAny(CMSecurity.SecGroup group,
                           boolean isSubOp)
Checks this group and all subgroups for access to any of the security flags or journal flags in the given group. It also checks for subop (area) access if the isSubOp flag is set.

Parameters:
group - the group containing flags to look for in this class
isSubOp - true if this should also check for equivalent subop (area) flags
Returns:
true if this group contains any of the security, false otherwise

size

public int size()
The number of all flags that this group was created with

Returns:
number of all flags that this group was created with

toString

public java.lang.String toString()
Converts this object to a ; delimited string

Overrides:
toString in class java.lang.Object
Returns:
a ; delimited representation of this object.

copyOf

public CMSecurity.SecGroup copyOf()
Returns an exact copy of this object.

Returns:
an exact copy of this object.

toString

public java.lang.String toString(char separatorChar)
Converts this group object to a delimited string

Parameters:
separatorChar - the delimiter
Returns:
this group object to a delimited string

paths

public java.util.Iterator<CMSecurity.SecPath> paths()
Returns an iterator of all file paths that this group has special access to, including those of subgroups.

Returns:
an iterator of all file paths

flags

public java.util.Iterator<CMSecurity.SecFlag> flags()
Returns an iterator through all the security flags that this group has access to, including all subgroups.

Returns:
an iterator through all the security flags in this group