com.planet_ink.coffee_mud.core
Class CMSecurity

java.lang.Object
  extended by com.planet_ink.coffee_mud.core.CMSecurity

public class CMSecurity
extends java.lang.Object

CMSecurity is the singleton that handles all security checks for all manner of resource access by users. It also handles certain flag systems, such as debug flags, resource re-save flags, and system disabling flags. Supported: (see SecFlag) ORDER includes TAKE, GIVE, DRESS, mob passivity, all follow ABOVELAW (also law books), WIZINV (includes see WIZINV), CMDMOBS (also prevents walkaways) SUPERSKILL (never fails skills), IMMORT (never dies), KILL* for deleting journal entries FS:relative path from /coffeemud/ -- read/write access to regular file sys VFS:relative path from /coffeemud/ -- read/write access to virtual file sys LIST: (affected by killx, cmdplayers, loadunload, cmdclans, ban, nopurge, cmditems, cmdmobs, cmdrooms, sessions, cmdareas, listadmin, stat) Like many similar systems, this class is thread-group-sensitive on some or all resources, allowing different security views to be presented to different "muds" according to the thread group the calling thread belongs to.


Nested Class Summary
static class CMSecurity.DbgFlag
          This enum represents all permitted DEBUG flags.
static class CMSecurity.DisFlag
          The enum that represents all the defined DISABLE flags.
static class CMSecurity.SaveFlag
          Save flags enum, for either turning off things that are normally saved to the database periodically, or turning on things that are not normally saved so that they do so.
static class CMSecurity.SecFlag
          This enum represents all of the base security flags in the system.
static class CMSecurity.SecGroup
          Internal security class for a group of security flags, and which may also containing other groups.
static class CMSecurity.SecPath
          A class representing a file path, either local or virtual, that a user can be given special access to.
 
Field Summary
protected  java.util.Set<java.lang.String> ablDisVars
           
protected  java.util.Set<java.lang.String> clsDisVars
           
protected  java.util.Map<java.lang.String,java.lang.String[]> clsEnaVars
           
protected  java.util.Set<java.lang.String> cmdDisVars
           
protected  MaskingLibrary.CompiledZMask compiledSysop
           
protected  java.util.Set<CMSecurity.DbgFlag> dbgVars
           
protected static boolean debuggingEverything
           
protected  java.util.Set<CMSecurity.DisFlag> disVars
           
protected static java.lang.String[] emptyStrArray
           
protected  java.util.Set<java.lang.String> expDisVars
           
protected  java.util.Set<java.lang.String> facDisVars
           
protected  java.util.Map<java.lang.String,CMSecurity.SecGroup> groups
           
protected  java.util.Set<java.lang.String> journalFlags
           
static int JSCRIPT__NO_APPROVAL
           
static int JSCRIPT_ALL_APPROVAL
           
static int JSCRIPT_REQ_APPROVAL
           
protected  java.util.Set<java.lang.String> racDisVars
           
protected  java.util.Map<java.lang.String,java.lang.String[]> racEnaVars
           
protected  java.util.Set<CMSecurity.SaveFlag> saveFlags
           
static CMSecurity.SecGroup SECURITY_CMD_GROUP
          Predefined security group set containing security flags related to the creation, modification, and destruction of most subsystems, including basic map editing abilities.
static CMSecurity.SecGroup SECURITY_COPY_GROUP
          Predefined security group set containing security flags related to the ability to copy existing mobs, items, and rooms around when building rooms and areas.
static CMSecurity.SecGroup SECURITY_EXPORT_GROUP
          Predefined security group set containing security flags related to the ability to export mobs, items, players, and rooms to a local file.
static CMSecurity.SecGroup SECURITY_GOTO_GROUP
          Predefined security group set containing security flags related to the ability to jump around on the map freely.
static CMSecurity.SecGroup SECURITY_IMPORT_GROUP
          Predefined security group set containing security flags related to the ability to import mobs, items, players, and rooms from local files into the map.
static CMSecurity.SecGroup SECURITY_KILL_GROUP
          Predefined security group set containing security flags related to the ability to instantly kill other mobs and players.
protected  long startTime
           
 
Constructor Summary
CMSecurity()
          Creates a new thread-group sensitive CMSecurity reference object.
 
Method Summary
static void approveJScript(java.lang.String approver, long hashCode)
          For muds using the JavaScript approval system, as specified in the coffeemud.ini file, this method approves a JavaScript as being permitted to run, and saves the record of the approval.
static int ban(java.lang.String banMe)
          Adds the given player name, account name, or ip address to the official ::/resources/banned.ini file It also adds it to the cached ban list.
static boolean canAccessFile(MOB mob, Room room, java.lang.String path, boolean isVFS)
          Checks whether the given user/player mob, in the given room location, can access a file at the given path, with the given VFS (database) status.
static boolean canTraverseDir(MOB mob, Room room, java.lang.String path)
          Checks whether the given user/player mob, in the given room location, can see a directory at the given path.
static void clearGroups()
          Removes all registered security groups.
 CMSecurity.SecGroup createGroup(java.lang.String name, java.util.List<java.lang.String> set)
          Create a new security group object with the given name, and the given set of security flags/group names as a string list.
static java.util.List<java.lang.String> getAccessibleDirs(MOB mob, Room room)
          Returns a comprehensive list of all filesystem directories which the given user/player, in the given room location, may access
static java.lang.String[] getAnyFlagEnabledParms(java.lang.String anyFlag)
          If the feature described by the given anyFlag is enabled, this will return any parameters defined along with it.
static java.util.Map<java.lang.Long,java.lang.String> getApprovedJScriptTable()
          For muds using the JavaScript approval system, this method returns the list of approval script approver names and their script hash value keys.
static java.util.Enumeration<CMSecurity.DisFlag> getBasicDisablesEnum()
          Returns an enumeration of all basic and special DisFlags that are currently set, meaning all the standard basic systems returned are disabled presently.
static java.util.Enumeration<CMSecurity.DbgFlag> getDebugEnum()
          An enumeration of all system currently being debugged.
static java.util.Enumeration<java.lang.String> getDisabledAbilitiesEnum(boolean addINIPrefix)
          Returns an enumeration of the disabled ability IDs, complete with flag prefix, if requested.
static java.util.Enumeration<java.lang.String> getDisabledCharClassEnum(boolean addINIPrefix)
          Returns an enumeration of the disabled character class IDs, complete with flag prefix, if requested.
static java.util.Enumeration<java.lang.String> getDisabledCommandsEnum(boolean addINIPrefix)
          Returns an enumeration of the disabled command IDs, complete with flag prefix, if requested.
static java.util.Enumeration<java.lang.String> getDisabledExpertisesEnum(boolean addINIPrefix)
          Returns an enumeration of the disabled expertise IDs, complete with flag prefix, if requested.
static java.util.Enumeration<java.lang.String> getDisabledFactionsEnum(boolean addINIPrefix)
          Returns an enumeration of the disabled faction IDs, complete with flag prefix, if requested.
static java.util.Enumeration<java.lang.String> getDisabledRacesEnum(boolean addINIPrefix)
          Returns an enumeration of the disabled race IDs, complete with flag prefix, if requested.
static java.util.Enumeration<java.lang.String> getDisabledSpecialsEnum(boolean addINIPrefix)
          Returns an enumeration of the disabled ability IDs, command IDs, expertise IDs, and faction IDs complete with flag prefix, if requested.
static java.util.Enumeration<java.lang.Object> getDisablesEnum()
          Returns an enumeration of all disable flags that are currently set, meaning all the things returned are disabled presently.
static java.util.Enumeration<java.lang.String> getEnabledCharClassEnum(boolean addINIPrefix)
          Returns an enumeration of the enabled character class IDs, complete with flag prefix, if requested.
static java.util.Enumeration<java.lang.String> getEnabledRacesEnum(boolean addINIPrefix)
          Returns an enumeration of the enabled race IDs, complete with flag prefix, if requested.
static java.util.Enumeration<java.lang.String> getEnabledSpecialsEnum(boolean addINIPrefix)
          Returns an enumeration of the enabled ability IDs, command IDs, charclass IDs, and race IDs complete with flag prefix, if requested.
static java.util.Enumeration<java.lang.Object> getEnablesEnum()
          Returns an enumeration of all basic enables flags that are currently set, meaning all the things returned are enabled, but normally disabled presently.
static java.util.Enumeration<java.lang.String> getJournalSecurityFlags()
          Returns an enumeration of all journal security flags, which are usually just a bunch of journal id names.
protected static java.util.Enumeration<java.lang.String> getSafeEnumerableEnableParmSet(java.util.Map<java.lang.String,java.lang.String[]> map, java.lang.String prefix)
          Returns an enumeration of the enabled IDs, with parms, and complete with flag prefix, if requested.
static java.util.Iterator<CMSecurity.SecFlag> getSecurityCodes(MOB mob, Room room)
          Returns an iterator of all security flags that apply to the given user/player mob for their given room location, which allows subop (area) flags to also be included, if the mob is in their subop area.
static java.util.Enumeration<CMSecurity.SecGroup> getSecurityGroups()
          Returns an enumeration of all existing Security Groups
static long getStartTime()
          How long the system has bee running, in milliseconds, I guess.
static boolean hasAccessibleDir(MOB mob, Room room)
          Checks whether the given user/player mob, in the given room location, can see ANY filesystem files.
static CMSecurity instance()
          Returns the CMSecurity instance tied to this particular thread group, or creates a new one.
static CMSecurity instance(char c)
          Returns the CMSecurity instance tied to this particular thread group, or null if not yet created.
static boolean isAbilityDisabled(java.lang.String ID)
          Check to see if the given Ability is disabled.
static boolean isAllowed(MOB mob, Room room, CMSecurity.SecFlag flag)
          A Security System check method.
static boolean isAllowedAnywhere(MOB mob, CMSecurity.SecFlag flag)
          A Security system check method.
static boolean isAllowedAnywhereContainsAny(MOB mob, CMSecurity.SecGroup secGroup)
          Checks whether the given mob has any of the security flags denoted by the given security group.
static boolean isAllowedContainsAny(MOB mob, Room room, CMSecurity.SecGroup secGroup)
          Checks whether the given mob, currently in the given room, has any of the security flags denoted by the given security group.
static boolean isAllowedEverywhere(MOB mob, CMSecurity.SecFlag flag)
          A Security system check method.
static boolean isAnyFlagDisabled(java.lang.String anyFlag)
          Returns whether the feature described by the given anyFlag is disabled.
static boolean isAnyFlagEnabled(java.lang.String anyFlag)
          Returns whether the feature described by the given anyFlag is enabled.
static boolean isApprovedJScript(java.lang.StringBuffer script)
          Checks whether the given specific javascript is allowed to run, given the javascript security settings.
static boolean isASysOp(MOB mob)
          Checks whether the given user/player MOB is a full-on Archon, an admin of the entire mud, having all the power the system offers.
static boolean isASysOp(PlayerLibrary.ThinPlayer mob)
          Checks whether the given user/player ThinPlayer object is a full-on admin of the entire mud, having all the power the system offers.
static boolean isBanned(java.lang.String login)
          Returns true if the given name or ip address or whatever is found in the official ::/resources/banned.ini file, which is cached in a list for quick access.
static boolean isCharClassDisabled(java.lang.String ID)
          Check to see if the given Character Class is disabled.
static boolean isCharClassEnabled(java.lang.String ID)
          Check to see if the given Character Class is enabled.
static boolean isCommandDisabled(java.lang.String ID)
          Check to see if the given Command is disabled.
static boolean isDebugging(CMSecurity.DbgFlag key)
          Checks if the given key system is being debugged.
static boolean isDebuggingSearch(java.lang.String key)
          Checks if the given key system is being debugged by finding the DbgFlag object that corresponds to the key name, and seeing if it is on the list of debugged systems.
static boolean isDisabled(CMSecurity.DisFlag flag)
          Checks to see if the given feature denoted by the given DisFlag is disabled.
static boolean isExpertiseDisabled(java.lang.String ID)
          Check to see if the given expertise is disabled.
static boolean isFactionDisabled(java.lang.String ID)
          Check to see if the given Faction is disabled.
static boolean isIPBlocked(java.lang.String ipAddress)
          Returns true if the given IP4 address is blocked, and false otherwise
static boolean isJournalAccessAllowed(MOB mob, java.lang.String journalFlagName)
          Checks whether the given user/player mob has admin privileges on the given journal
static boolean isRaceDisabled(java.lang.String ID)
          Check to see if the given Race is disabled.
static boolean isRaceEnabled(java.lang.String ID)
          Check to see if the given Race is enabled.
static boolean isSaveFlag(CMSecurity.SaveFlag key)
          Returns whether the given save flag is set, denoting something that should not be saved but normally is, or something that should be saved, but normally isn't
static boolean isStaff(MOB mob)
          Checks to see if the given user/player mob has any special security flags at all.
 void markShared()
          Designates that the thread which called this method should instead use the security system of the MAIN_HOST, sharing it.
static void parseGroups(java.util.Properties page)
          Iterates through all the properties on the given property page, finding any security group definitions and, when found, registering them with the security system.
 java.lang.Object parseSecurityFlag(java.lang.String s)
          Accepts a string representing a security flag, or another group name, or a filesystem path, or some other security designation, and returns the appropriate object, such as a SecGroup, SecPath, SecFlag, or String, that it represents.
static void registerJournal(java.lang.String journalName)
          Registers a new journal security flag, which is typically just its name
static boolean removeAnyDisableVar(java.lang.String anyFlag)
          Since there are several different kinds of disable flags, this method allows of the different kinds to be removed/un-set simply by sending the string.
static boolean removeAnyEnableVar(java.lang.String anyFlag)
          Since there are several different kinds of enable flags, this method allows of the different kinds to be removed/un-set simply by sending the string.
static boolean removeDebugVar(CMSecurity.DbgFlag var)
          Removes the given debug flag by removing it from the list of debug flags.
static boolean removeDebugVar(java.lang.String anyFlag)
          Removes the given debug flag by finding the flag that corresponds to the given string and removing it from the list of debug flags.
static boolean removeDisableVar(CMSecurity.DisFlag flag)
          Removes the given disable flag, deactivating it
static void removeSaveFlag(CMSecurity.SaveFlag flag)
          Removes the given save flag, deactivating it
static boolean setAnyDisableVar(java.lang.String anyFlag)
          Since there are several different kinds of disable flags, this method allows of the different kinds to be set simply by sending the string.
static void setAnyDisableVars(java.lang.String commaDelimFlagList)
          Sets all disable flags of all types given a list of comma-delimited flag names in a string.
static boolean setAnyEnableVar(java.lang.String anyFlag)
          Since there are several different kinds of enable flags, this method allows of the different kinds to be set simply by sending the string.
static void setAnyEnableVars(java.lang.String commaDelimFlagList)
          Sets all enable flags of all types given a list of comma-delimited flag names in a string.
static boolean setDebugVar(CMSecurity.DbgFlag var)
          Sets the given debug flag by adding it to the list of debug flags.
static boolean setDebugVar(java.lang.String anyFlag)
          Sets the given debug flag by finding the flag that corresponds to the given string and adding it to the list of debug flags.
static void setDebugVars(java.lang.String varList)
          Sets all DbgFlag debug flags given a comma-delimited list of debug flag names.
static boolean setDisableVar(CMSecurity.DisFlag flag)
          Adds the given disable flag, activating it
static void setSaveFlag(CMSecurity.SaveFlag flag)
          Adds the given save flag, activating it
static void setSaveFlags(java.lang.String flagsListStr)
          Sets all the SaveFlags from a comma-delimited list, activating them.
static void setSysOp(java.lang.String zapCheck)
          Redefines the ZapperMask that defines what an All Powerful Super Admin of the entire mud player looks like.
static java.lang.String unban(int unBanMe)
          Removes the given player name, account name, or ip address that can be found at the given index from the official ::/resources/banned.ini file.
static void unban(java.lang.String unBanMe)
          Removes the given player name, account name, or ip address from the official ::/resources/banned.ini file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JSCRIPT__NO_APPROVAL

public static final int JSCRIPT__NO_APPROVAL
See Also:
Constant Field Values

JSCRIPT_REQ_APPROVAL

public static final int JSCRIPT_REQ_APPROVAL
See Also:
Constant Field Values

JSCRIPT_ALL_APPROVAL

public static final int JSCRIPT_ALL_APPROVAL
See Also:
Constant Field Values

emptyStrArray

protected static final java.lang.String[] emptyStrArray

disVars

protected final java.util.Set<CMSecurity.DisFlag> disVars

cmdDisVars

protected final java.util.Set<java.lang.String> cmdDisVars

racDisVars

protected final java.util.Set<java.lang.String> racDisVars

clsDisVars

protected final java.util.Set<java.lang.String> clsDisVars

facDisVars

protected final java.util.Set<java.lang.String> facDisVars

ablDisVars

protected final java.util.Set<java.lang.String> ablDisVars

expDisVars

protected final java.util.Set<java.lang.String> expDisVars

dbgVars

protected final java.util.Set<CMSecurity.DbgFlag> dbgVars

saveFlags

protected final java.util.Set<CMSecurity.SaveFlag> saveFlags

journalFlags

protected final java.util.Set<java.lang.String> journalFlags

racEnaVars

protected final java.util.Map<java.lang.String,java.lang.String[]> racEnaVars

clsEnaVars

protected final java.util.Map<java.lang.String,java.lang.String[]> clsEnaVars

startTime

protected final long startTime

compiledSysop

protected MaskingLibrary.CompiledZMask compiledSysop

groups

protected final java.util.Map<java.lang.String,CMSecurity.SecGroup> groups

debuggingEverything

protected static boolean debuggingEverything

SECURITY_COPY_GROUP

public static final CMSecurity.SecGroup SECURITY_COPY_GROUP
Predefined security group set containing security flags related to the ability to copy existing mobs, items, and rooms around when building rooms and areas.


SECURITY_GOTO_GROUP

public static final CMSecurity.SecGroup SECURITY_GOTO_GROUP
Predefined security group set containing security flags related to the ability to jump around on the map freely.


SECURITY_KILL_GROUP

public static final CMSecurity.SecGroup SECURITY_KILL_GROUP
Predefined security group set containing security flags related to the ability to instantly kill other mobs and players.


SECURITY_IMPORT_GROUP

public static final CMSecurity.SecGroup SECURITY_IMPORT_GROUP
Predefined security group set containing security flags related to the ability to import mobs, items, players, and rooms from local files into the map.


SECURITY_EXPORT_GROUP

public static final CMSecurity.SecGroup SECURITY_EXPORT_GROUP
Predefined security group set containing security flags related to the ability to export mobs, items, players, and rooms to a local file.


SECURITY_CMD_GROUP

public static final CMSecurity.SecGroup SECURITY_CMD_GROUP
Predefined security group set containing security flags related to the creation, modification, and destruction of most subsystems, including basic map editing abilities.

Constructor Detail

CMSecurity

public CMSecurity()
Creates a new thread-group sensitive CMSecurity reference object.

Method Detail

instance

public static final CMSecurity instance()
Returns the CMSecurity instance tied to this particular thread group, or creates a new one.

Returns:
the CMSecurity instance tied to this particular thread group, or creates a new one.

instance

public static final CMSecurity instance(char c)
Returns the CMSecurity instance tied to this particular thread group, or null if not yet created.

Parameters:
c - the thread group to check
Returns:
the CMSecurity instance tied to this particular thread group, or null if not yet created.

markShared

public final void markShared()
Designates that the thread which called this method should instead use the security system of the MAIN_HOST, sharing it.


setSysOp

public static final void setSysOp(java.lang.String zapCheck)
Redefines the ZapperMask that defines what an All Powerful Super Admin of the entire mud player looks like. God help anyone that calls this method and doesn't know what they are doing.

Parameters:
zapCheck - the zapper mask identifying an "archon" (a SysOp Admin)

registerJournal

public static final void registerJournal(java.lang.String journalName)
Registers a new journal security flag, which is typically just its name

Parameters:
journalName - the journal security flag, or just the name/ID of the journal

clearGroups

public static final void clearGroups()
Removes all registered security groups.


parseGroups

public static final void parseGroups(java.util.Properties page)
Iterates through all the properties on the given property page, finding any security group definitions and, when found, registering them with the security system.

Parameters:
page - the properties page to go through.

parseSecurityFlag

public java.lang.Object parseSecurityFlag(java.lang.String s)
Accepts a string representing a security flag, or another group name, or a filesystem path, or some other security designation, and returns the appropriate object, such as a SecGroup, SecPath, SecFlag, or String, that it represents.

Parameters:
s - the security thing to parse and identify
Returns:
the internal security object that the string represents

createGroup

public final CMSecurity.SecGroup createGroup(java.lang.String name,
                                             java.util.List<java.lang.String> set)
Create a new security group object with the given name, and the given set of security flags/group names as a string list.

Parameters:
name - the new security group name
set - the string list of flags/group names
Returns:
the new security group object

getSecurityGroups

public static java.util.Enumeration<CMSecurity.SecGroup> getSecurityGroups()
Returns an enumeration of all existing Security Groups

Returns:
an enumeration of all existing Security Groups

getJournalSecurityFlags

public static java.util.Enumeration<java.lang.String> getJournalSecurityFlags()
Returns an enumeration of all journal security flags, which are usually just a bunch of journal id names.

Returns:
an enumeration of all journal security flags

isASysOp

public static final boolean isASysOp(MOB mob)
Checks whether the given user/player MOB is a full-on Archon, an admin of the entire mud, having all the power the system offers.

Parameters:
mob - the user/player to check
Returns:
true if the MOB represents a SysOp (Archon), false otherwise.

isASysOp

public static final boolean isASysOp(PlayerLibrary.ThinPlayer mob)
Checks whether the given user/player ThinPlayer object is a full-on admin of the entire mud, having all the power the system offers.

Parameters:
mob - the user/player to check, as a ThinPlayer object
Returns:
true if the ThinPlayer represents a SysOp (Archon), false otherwise.

isStaff

public static final boolean isStaff(MOB mob)
Checks to see if the given user/player mob has any special security flags at all. This would encompass subops (area) as well as regular admins.

Parameters:
mob - the user/player to check
Returns:
true if the user/player has at least one security flag, false otherwise

getAccessibleDirs

public static final java.util.List<java.lang.String> getAccessibleDirs(MOB mob,
                                                                       Room room)
Returns a comprehensive list of all filesystem directories which the given user/player, in the given room location, may access

Parameters:
mob - the user/player to check
room - the room location of the above user/player
Returns:
the list of all directories this user/player can access

hasAccessibleDir

public static final boolean hasAccessibleDir(MOB mob,
                                             Room room)
Checks whether the given user/player mob, in the given room location, can see ANY filesystem files. The room location allows subop (area) permissions to kick in.

Parameters:
mob - the user/player to check
room - the room location of the above user/player
Returns:
true if the user/player has permission to use any files in the filesystem, and false otherwise

canTraverseDir

public static final boolean canTraverseDir(MOB mob,
                                           Room room,
                                           java.lang.String path)
Checks whether the given user/player mob, in the given room location, can see a directory at the given path. The room location allows subop (area) permissions to kick in.

Parameters:
mob - the user/player to check
room - the room location of the above user/player
path - the path of the file to check permissions on
Returns:
true if the user/player has permission to see and CD into the given directory, false otherwise.

canAccessFile

public static final boolean canAccessFile(MOB mob,
                                          Room room,
                                          java.lang.String path,
                                          boolean isVFS)
Checks whether the given user/player mob, in the given room location, can access a file at the given path, with the given VFS (database) status. The room location allows subop (area) permissions to kick in.

Parameters:
mob - the user/player to check
room - the room location of the above user/player
path - the path of the file to check permissions on
isVFS - whether the file denoted by the above path is in the database (VFS) or not
Returns:
true if the user/player has permission to access the given file, false otherwise.

getSecurityCodes

public static final java.util.Iterator<CMSecurity.SecFlag> getSecurityCodes(MOB mob,
                                                                            Room room)
Returns an iterator of all security flags that apply to the given user/player mob for their given room location, which allows subop (area) flags to also be included, if the mob is in their subop area.

Parameters:
mob - the user/player to check
room - the room location of the above user/player
Returns:
an iterator of all applicable security flags

isJournalAccessAllowed

public static boolean isJournalAccessAllowed(MOB mob,
                                             java.lang.String journalFlagName)
Checks whether the given user/player mob has admin privileges on the given journal

Parameters:
mob - the user/player to check
journalFlagName - the journal flag, almost always the journal ID
Returns:
true if the mob is an admin, and false otherwise

isAllowedContainsAny

public static final boolean isAllowedContainsAny(MOB mob,
                                                 Room room,
                                                 CMSecurity.SecGroup secGroup)
Checks whether the given mob, currently in the given room, has any of the security flags denoted by the given security group.

Parameters:
mob - the user/player to check security settings on
room - the user/players current room location, for subop (area) permission checks
secGroup - the security group whose flags are cross-referenced against the players security settings
Returns:
true if any of the security group flags are permitted by this user, false otherwise

isAllowed

public static final boolean isAllowed(MOB mob,
                                      Room room,
                                      CMSecurity.SecFlag flag)
A Security System check method. Checks whether the given user/player mob, who is presently in the given room, is permitted to perform the function denoted by the given security flag. The room check allows subop/area based security to come into play. This is the most commonly used security method

Parameters:
mob - the user/player to check security permissions on
room - the current room location of the above user/player
flag - the security flag to check for
Returns:
true if the user/player is permitted, and false otherwise

isAllowedAnywhereContainsAny

public static final boolean isAllowedAnywhereContainsAny(MOB mob,
                                                         CMSecurity.SecGroup secGroup)
Checks whether the given mob has any of the security flags denoted by the given security group. This method checks all locations, allowing subops to be triggered based on their area permissions, even if they are not presently in that area.

Parameters:
mob - the user/player to check security settings on
secGroup - the security group whose flags are cross-referenced against the players security settings
Returns:
true if any of the security group flags are permitted by this user, false otherwise

isAllowedEverywhere

public static final boolean isAllowedEverywhere(MOB mob,
                                                CMSecurity.SecFlag flag)
A Security system check method. Returns whether the given player mob object is permitted to perform the function denoted by the given flag everywhere in the mud. This tends to discount subop/area based permissions.

Parameters:
mob - the player to check
flag - the flag to look for
Returns:
true if the player is permitted, and false otherwise

isAllowedAnywhere

public static final boolean isAllowedAnywhere(MOB mob,
                                              CMSecurity.SecFlag flag)
A Security system check method. Returns whether the given player mob object is permitted to perform the function denoted by the given flag anywhere in the mud. This tends to favor subop/area based permissions, since it checks for subop security even when the player is not currently in their area.

Parameters:
mob - the player to check
flag - the flag to look for
Returns:
true if the player is permitted, and false otherwise

isSaveFlag

public static final boolean isSaveFlag(CMSecurity.SaveFlag key)
Returns whether the given save flag is set, denoting something that should not be saved but normally is, or something that should be saved, but normally isn't

Parameters:
key - the SaveFlag enum object to check for
Returns:
true if the SaveFlag was found, false otherwise.

approveJScript

public static final void approveJScript(java.lang.String approver,
                                        long hashCode)
For muds using the JavaScript approval system, as specified in the coffeemud.ini file, this method approves a JavaScript as being permitted to run, and saves the record of the approval.

Parameters:
approver - the name of the player approving the script
hashCode - the hash value of the script being approved

getApprovedJScriptTable

public static final java.util.Map<java.lang.Long,java.lang.String> getApprovedJScriptTable()
For muds using the JavaScript approval system, this method returns the list of approval script approver names and their script hash value keys.

Returns:
the list of approved scripts and their approvers, keyed by their script hash values

isApprovedJScript

public static final boolean isApprovedJScript(java.lang.StringBuffer script)
Checks whether the given specific javascript is allowed to run, given the javascript security settings.

Parameters:
script - the script to check
Returns:
true if it can run right now, false otherwise.

getDebugEnum

public static java.util.Enumeration<CMSecurity.DbgFlag> getDebugEnum()
An enumeration of all system currently being debugged.

Returns:
enumeration of all system currently being debugged.

isDebugging

public static final boolean isDebugging(CMSecurity.DbgFlag key)
Checks if the given key system is being debugged.

Parameters:
key - the DbgFlag debug system to check
Returns:
true if the given system is being debugged, false otherwise

isDebuggingSearch

public static final boolean isDebuggingSearch(java.lang.String key)
Checks if the given key system is being debugged by finding the DbgFlag object that corresponds to the key name, and seeing if it is on the list of debugged systems.

Parameters:
key - the name of the debug flag to look for.
Returns:
true if the key was found and is being debugged, false otherwise

setDebugVar

public static final boolean setDebugVar(CMSecurity.DbgFlag var)
Sets the given debug flag by adding it to the list of debug flags.

Parameters:
var - the debug flag
Returns:
true if the flag was not already set, false otherwise

removeDebugVar

public static final boolean removeDebugVar(CMSecurity.DbgFlag var)
Removes the given debug flag by removing it from the list of debug flags.

Parameters:
var - the debug flag
Returns:
true if the flag needed removing, false otherwise

setDebugVar

public static final boolean setDebugVar(java.lang.String anyFlag)
Sets the given debug flag by finding the flag that corresponds to the given string and adding it to the list of debug flags.

Parameters:
anyFlag - the name of the debug flag
Returns:
true if the flag was found but not already set, false otherwise

removeDebugVar

public static final boolean removeDebugVar(java.lang.String anyFlag)
Removes the given debug flag by finding the flag that corresponds to the given string and removing it from the list of debug flags.

Parameters:
anyFlag - the name of the debug flag
Returns:
true if the flag was found and needed removing, false otherwise

setDebugVars

public static final void setDebugVars(java.lang.String varList)
Sets all DbgFlag debug flags given a comma-delimited list of debug flag names.

Parameters:
varList - the comma-delimited list of debug flags to set.

isRaceEnabled

public static final boolean isRaceEnabled(java.lang.String ID)
Check to see if the given Race is enabled.

Parameters:
ID - the official Race ID
Returns:
true if it is enabled, false otherwise

isCharClassEnabled

public static final boolean isCharClassEnabled(java.lang.String ID)
Check to see if the given Character Class is enabled.

Parameters:
ID - the official Class ID
Returns:
true if it is enabled, false otherwise

getEnablesEnum

public static java.util.Enumeration<java.lang.Object> getEnablesEnum()
Returns an enumeration of all basic enables flags that are currently set, meaning all the things returned are enabled, but normally disabled presently.

Returns:
an enumeration of all enable flags that are currently set

getEnabledRacesEnum

public static final java.util.Enumeration<java.lang.String> getEnabledRacesEnum(boolean addINIPrefix)
Returns an enumeration of the enabled race IDs, complete with flag prefix, if requested.

Parameters:
addINIPrefix - true to add the prefix required in the ini file, false for a plain ID
Returns:
an enumeration of the enabled race IDs

getSafeEnumerableEnableParmSet

protected static java.util.Enumeration<java.lang.String> getSafeEnumerableEnableParmSet(java.util.Map<java.lang.String,java.lang.String[]> map,
                                                                                        java.lang.String prefix)
Returns an enumeration of the enabled IDs, with parms, and complete with flag prefix, if requested.

Parameters:
map - the enabled set to use
prefix - the prefix to add, if any
Returns:
an enumeration of the enabled IDs

getEnabledCharClassEnum

public static final java.util.Enumeration<java.lang.String> getEnabledCharClassEnum(boolean addINIPrefix)
Returns an enumeration of the enabled character class IDs, complete with flag prefix, if requested.

Parameters:
addINIPrefix - true to add the prefix required in the ini file, false for a plain ID
Returns:
an enumeration of the enabled character class IDs

removeAnyEnableVar

public static final boolean removeAnyEnableVar(java.lang.String anyFlag)
Since there are several different kinds of enable flags, this method allows of the different kinds to be removed/un-set simply by sending the string.

Parameters:
anyFlag - the thing to re-enable
Returns:
true if anyFlag was a valid thing to re-enable, and false otherwise

setAnyEnableVar

public static final boolean setAnyEnableVar(java.lang.String anyFlag)
Since there are several different kinds of enable flags, this method allows of the different kinds to be set simply by sending the string.

Parameters:
anyFlag - the thing to enable
Returns:
true if anyFlag was a valid thing to enable, and false otherwise

isAnyFlagEnabled

public static final boolean isAnyFlagEnabled(java.lang.String anyFlag)
Returns whether the feature described by the given anyFlag is enabled. Since there are several different kinds of enable flags, this method will check the prefix of each flag to determine which kind it is.

Parameters:
anyFlag - the flag to check for
Returns:
true if it's already enabled, and false otherwise

getAnyFlagEnabledParms

public static final java.lang.String[] getAnyFlagEnabledParms(java.lang.String anyFlag)
If the feature described by the given anyFlag is enabled, this will return any parameters defined along with it. Normally this is an empty string array, but character classes may have race qualification flags added after them, which this supports.

Parameters:
anyFlag - the flag to check for
Returns:
an empty array, or an array of parameters after the flag set

setAnyEnableVars

public static final void setAnyEnableVars(java.lang.String commaDelimFlagList)
Sets all enable flags of all types given a list of comma-delimited flag names in a string. Since there are several different kinds of enable flags, this method will check the prefix of each flag to determine which kind it is. It will log an error if any flag is unrecognized.

Parameters:
commaDelimFlagList - the list of flags, comma delimited

getEnabledSpecialsEnum

public static final java.util.Enumeration<java.lang.String> getEnabledSpecialsEnum(boolean addINIPrefix)
Returns an enumeration of the enabled ability IDs, command IDs, charclass IDs, and race IDs complete with flag prefix, if requested.

Parameters:
addINIPrefix - true to add the prefix required in the ini file, false for a plain ID
Returns:
an enumeration of the enabled ability, command, charclass, and race IDs

getBasicDisablesEnum

public static java.util.Enumeration<CMSecurity.DisFlag> getBasicDisablesEnum()
Returns an enumeration of all basic and special DisFlags that are currently set, meaning all the standard basic systems returned are disabled presently.

Returns:
an enumeration of all basic DisFlags that are currently set

getDisablesEnum

public static java.util.Enumeration<java.lang.Object> getDisablesEnum()
Returns an enumeration of all disable flags that are currently set, meaning all the things returned are disabled presently.

Returns:
an enumeration of all flags that are currently set

isDisabled

public static final boolean isDisabled(CMSecurity.DisFlag flag)
Checks to see if the given feature denoted by the given DisFlag is disabled.

Parameters:
flag - the DisFlag to check for
Returns:
true if it is disabled, and false otherwise

isCommandDisabled

public static final boolean isCommandDisabled(java.lang.String ID)
Check to see if the given Command is disabled.

Parameters:
ID - the official Command ID
Returns:
true if it is disabled, false otherwise

isRaceDisabled

public static final boolean isRaceDisabled(java.lang.String ID)
Check to see if the given Race is disabled.

Parameters:
ID - the official Race ID
Returns:
true if it is disabled, false otherwise

isCharClassDisabled

public static final boolean isCharClassDisabled(java.lang.String ID)
Check to see if the given Character Class is disabled.

Parameters:
ID - the official Class ID
Returns:
true if it is disabled, false otherwise

isAbilityDisabled

public static final boolean isAbilityDisabled(java.lang.String ID)
Check to see if the given Ability is disabled.

Parameters:
ID - the official Ability ID
Returns:
true if it is disabled, false otherwise

isFactionDisabled

public static final boolean isFactionDisabled(java.lang.String ID)
Check to see if the given Faction is disabled.

Parameters:
ID - the official Faction ID
Returns:
true if it is disabled, false otherwise

isExpertiseDisabled

public static final boolean isExpertiseDisabled(java.lang.String ID)
Check to see if the given expertise is disabled.

Parameters:
ID - the official expertise ID
Returns:
true if it is disabled, false otherwise

isAnyFlagDisabled

public static final boolean isAnyFlagDisabled(java.lang.String anyFlag)
Returns whether the feature described by the given anyFlag is disabled. Since there are several different kinds of disable flags, this method will check the prefix of each flag to determine which kind it is.

Parameters:
anyFlag - the flag to check for
Returns:
true if it's already disabled, and false otherwise

setAnyDisableVars

public static final void setAnyDisableVars(java.lang.String commaDelimFlagList)
Sets all disable flags of all types given a list of comma-delimited flag names in a string. Since there are several different kinds of disable flags, this method will check the prefix of each flag to determine which kind it is. It will log an error if any flag is unrecognized.

Parameters:
commaDelimFlagList - the list of flags, comma delimited

removeAnyDisableVar

public static final boolean removeAnyDisableVar(java.lang.String anyFlag)
Since there are several different kinds of disable flags, this method allows of the different kinds to be removed/un-set simply by sending the string. The DisFlag objects are covered by this, but so are command disablings, abilities, expertises, etc..

Parameters:
anyFlag - the thing to re-enable
Returns:
true if anyFlag was a valid thing to re-enable, and false otherwise

setAnyDisableVar

public static final boolean setAnyDisableVar(java.lang.String anyFlag)
Since there are several different kinds of disable flags, this method allows of the different kinds to be set simply by sending the string. The DisFlag objects are covered by this, but so are command disablings, abilities, expertises, etc..

Parameters:
anyFlag - the thing to disable
Returns:
true if anyFlag was a valid thing to disable, and false otherwise

getDisabledSpecialsEnum

public static final java.util.Enumeration<java.lang.String> getDisabledSpecialsEnum(boolean addINIPrefix)
Returns an enumeration of the disabled ability IDs, command IDs, expertise IDs, and faction IDs complete with flag prefix, if requested.

Parameters:
addINIPrefix - true to add the prefix required in the ini file, false for a plain ID
Returns:
an enumeration of the disabled ability, command, expertise, and faction IDs

getDisabledAbilitiesEnum

public static final java.util.Enumeration<java.lang.String> getDisabledAbilitiesEnum(boolean addINIPrefix)
Returns an enumeration of the disabled ability IDs, complete with flag prefix, if requested.

Parameters:
addINIPrefix - true to add the prefix required in the ini file, false for a plain ID
Returns:
an enumeration of the disabled ability IDs

getDisabledExpertisesEnum

public static final java.util.Enumeration<java.lang.String> getDisabledExpertisesEnum(boolean addINIPrefix)
Returns an enumeration of the disabled expertise IDs, complete with flag prefix, if requested.

Parameters:
addINIPrefix - true to add the prefix required in the ini file, false for a plain ID
Returns:
an enumeration of the disabled expertise IDs

getDisabledCommandsEnum

public static final java.util.Enumeration<java.lang.String> getDisabledCommandsEnum(boolean addINIPrefix)
Returns an enumeration of the disabled command IDs, complete with flag prefix, if requested.

Parameters:
addINIPrefix - true to add the prefix required in the ini file, false for a plain ID
Returns:
an enumeration of the disabled command IDs

getDisabledRacesEnum

public static final java.util.Enumeration<java.lang.String> getDisabledRacesEnum(boolean addINIPrefix)
Returns an enumeration of the disabled race IDs, complete with flag prefix, if requested.

Parameters:
addINIPrefix - true to add the prefix required in the ini file, false for a plain ID
Returns:
an enumeration of the disabled race IDs

getDisabledCharClassEnum

public static final java.util.Enumeration<java.lang.String> getDisabledCharClassEnum(boolean addINIPrefix)
Returns an enumeration of the disabled character class IDs, complete with flag prefix, if requested.

Parameters:
addINIPrefix - true to add the prefix required in the ini file, false for a plain ID
Returns:
an enumeration of the disabled character class IDs

getDisabledFactionsEnum

public static final java.util.Enumeration<java.lang.String> getDisabledFactionsEnum(boolean addINIPrefix)
Returns an enumeration of the disabled faction IDs, complete with flag prefix, if requested.

Parameters:
addINIPrefix - true to add the prefix required in the ini file, false for a plain ID
Returns:
an enumeration of the disabled faction IDs

setDisableVar

public static final boolean setDisableVar(CMSecurity.DisFlag flag)
Adds the given disable flag, activating it

Parameters:
flag - the DisFlag to add.
Returns:
true if the flag was changed, false if it was already set

removeDisableVar

public static final boolean removeDisableVar(CMSecurity.DisFlag flag)
Removes the given disable flag, deactivating it

Parameters:
flag - the DisFlag to remove.
Returns:
true if the flag was removed, false if it was not set

setSaveFlags

public static final void setSaveFlags(java.lang.String flagsListStr)
Sets all the SaveFlags from a comma-delimited list, activating them.

Parameters:
flagsListStr - a comma-delimited list of SaveFlag names

setSaveFlag

public static final void setSaveFlag(CMSecurity.SaveFlag flag)
Adds the given save flag, activating it

Parameters:
flag - the SaveFlag to add.

removeSaveFlag

public static final void removeSaveFlag(CMSecurity.SaveFlag flag)
Removes the given save flag, deactivating it

Parameters:
flag - the SaveFlag to remove.

getStartTime

public static final long getStartTime()
How long the system has bee running, in milliseconds, I guess.

Returns:
how long the system has bee running, in milliseconds, I guess.

isIPBlocked

public static boolean isIPBlocked(java.lang.String ipAddress)
Returns true if the given IP4 address is blocked, and false otherwise

Parameters:
ipAddress - the IP4 address to look for
Returns:
true if the given IP4 address is blocked, and false otherwise

isBanned

public static final boolean isBanned(java.lang.String login)
Returns true if the given name or ip address or whatever is found in the official ::/resources/banned.ini file, which is cached in a list for quick access. The search is case insensitive, and any entry may start with *, end with *, or both.

Parameters:
login - the string to look for
Returns:
true if there was a match, and false otherwise.

unban

public static final void unban(java.lang.String unBanMe)
Removes the given player name, account name, or ip address from the official ::/resources/banned.ini file. It also removes it from the cached ban list.

Parameters:
unBanMe - the player name, account name, or ip address to remove

unban

public static final java.lang.String unban(int unBanMe)
Removes the given player name, account name, or ip address that can be found at the given index from the official ::/resources/banned.ini file. It also removes it from the cached ban list.

Parameters:
unBanMe - the player name, account name, or ip address index in the banned.ini file to remove
Returns:
The name that was banned

ban

public static final int ban(java.lang.String banMe)
Adds the given player name, account name, or ip address to the official ::/resources/banned.ini file It also adds it to the cached ban list.

Parameters:
banMe - the player name, account name, or ip address to add
Returns:
-1 if the new entry was added, and an index >=0 if it was already on the list beforehand