|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectru.tehkode.permissions.PermissionEntity
ru.tehkode.permissions.PermissionUser
public abstract class PermissionUser
Field Summary | |
---|---|
protected HashMap<String,String> |
cachedAnwsers
|
protected Map<String,List<PermissionGroup>> |
cachedGroups
|
protected HashMap<String,String> |
cachedOptions
|
protected Map<String,String[]> |
cachedPermissions
|
protected Map<String,String> |
cachedPrefix
|
protected Map<String,String> |
cachedSuffix
|
Fields inherited from class ru.tehkode.permissions.PermissionEntity |
---|
debugMode, manager, patternCache, rangeExpression, timedPermissions, timedPermissionsTime, virtual |
Constructor Summary | |
---|---|
PermissionUser(String playerName,
PermissionManager manager)
|
Method Summary | |
---|---|
void |
addGroup(PermissionGroup group)
|
void |
addGroup(PermissionGroup group,
String worldName)
Add user to group |
void |
addGroup(String groupName)
|
void |
addGroup(String groupName,
String worldName)
Add user to group |
void |
addPermission(String permission,
String worldName)
Add permissions for specified world |
void |
addTimedPermission(String permission,
String world,
int lifeTime)
Adds timed permission to specified world in seconds |
protected void |
clearCache()
|
PermissionGroup |
demote(PermissionUser demoter,
String ladderName)
Demotes user in specified ladder. |
boolean |
explainExpression(String expression)
|
Map<String,PermissionGroup[]> |
getAllGroups()
|
PermissionGroup[] |
getGroups()
Get group for this user, global inheritance only |
PermissionGroup[] |
getGroups(String worldName)
Get groups for this user for specified world |
String[] |
getGroupsNames()
Get group names, common space only |
String[] |
getGroupsNames(String worldName)
Get group names in specified world |
protected abstract String[] |
getGroupsNamesImpl(String worldName)
|
protected void |
getInheritedPermissions(String worldName,
List<String> permissions,
boolean groupInheritance,
boolean worldInheritance)
|
String |
getMatchingExpression(String permission,
String world)
|
String |
getOption(String optionName,
String worldName,
String defaultValue)
Get option in world |
String |
getOwnOption(String option)
Return non-inherited value of specified option in common space (all worlds). |
String |
getOwnOption(String option,
String world)
|
abstract String |
getOwnOption(String option,
String world,
String defaultValue)
Return non-inherited value of specified option for user in world |
boolean |
getOwnOptionBoolean(String optionName,
String world,
boolean defaultValue)
|
double |
getOwnOptionDouble(String optionName,
String world,
double defaultValue)
|
int |
getOwnOptionInteger(String optionName,
String world,
int defaultValue)
|
abstract String[] |
getOwnPermissions(String world)
Return non-inherited permissions of a user in world |
String |
getOwnPrefix()
Return non-inherited user prefix. |
abstract String |
getOwnPrefix(String worldName)
|
String |
getOwnSuffix()
Return non-inherited suffix prefix. |
abstract String |
getOwnSuffix(String worldName)
|
String[] |
getPermissions(String worldName)
Return all entity permissions in specified world |
String |
getPrefix(String worldName)
Returns entity prefix |
protected int |
getPromoterRankAndCheck(PermissionUser promoter,
String ladderName)
|
int |
getRank(String ladder)
Return user rank in specified ladder |
PermissionGroup |
getRankLadderGroup(String ladder)
Return user's group in specified ladder |
Map<String,PermissionGroup> |
getRankLadders()
Return all ladders the user is participating in |
String |
getSuffix(String worldName)
Return entity suffix |
protected PermissionGroup[] |
getWorldGroups(String worldName)
|
boolean |
has(String permission)
Checks if entity has specified permission in default world |
boolean |
inGroup(PermissionGroup group)
|
boolean |
inGroup(PermissionGroup group,
boolean checkInheritance)
|
boolean |
inGroup(PermissionGroup group,
String worldName)
Check if this user is member of group or one of its descendant groups |
boolean |
inGroup(PermissionGroup group,
String worldName,
boolean checkInheritance)
Check if this user is member of group or one of its descendant groups (optionally) |
boolean |
inGroup(String groupName)
|
boolean |
inGroup(String groupName,
boolean checkInheritance)
|
boolean |
inGroup(String groupName,
String worldName)
Checks if this user is member of specified group or one of its descendant groups |
boolean |
inGroup(String groupName,
String worldName,
boolean checkInheritance)
Check if this user is member of group or one of its descendant groups (optionally) |
void |
initialize()
This method 100% run after all constructors have been run and entity object, and entity object are completely ready to operate |
boolean |
isRanked(String ladder)
Check if the user is in the specified ladder |
PermissionGroup |
promote(PermissionUser promoter,
String ladderName)
Promotes user in specified ladder. |
void |
remove()
Remove entity data from backend |
void |
removeGroup(PermissionGroup group)
|
void |
removeGroup(PermissionGroup group,
String worldName)
Remove user from group |
void |
removeGroup(String groupName)
|
void |
removeGroup(String groupName,
String worldName)
Remove user from group |
void |
removePermission(String permission,
String worldName)
Remove permission in world |
void |
removeTimedPermission(String permission,
String world)
Removes specified timed permission for world |
void |
save()
Save in-memory data to storage backend |
void |
setGroups(PermissionGroup[] parentGroups)
|
void |
setGroups(PermissionGroup[] parentGroups,
String worldName)
Set parent groups for user |
void |
setGroups(String[] groups)
|
abstract void |
setGroups(String[] groups,
String worldName)
Set parent groups for user |
void |
setPrefix(String prefix,
String worldName)
Set prefix to value |
void |
setSuffix(String postfix,
String worldName)
Set suffix to value |
protected void |
swapGroups(PermissionGroup src,
PermissionGroup dst)
|
Methods inherited from class ru.tehkode.permissions.PermissionEntity |
---|
addPermission, callEvent, callEvent, equals, getAllOptions, getAllPermissions, getMatchingExpression, getName, getOption, getOption, getOptionBoolean, getOptionDouble, getOptionInteger, getOptions, getPrefix, getSuffix, getTimedPermissionLifetime, getTimedPermissions, getWorlds, has, hashCode, isDebug, isMatches, isVirtual, prepareRegexp, removePermission, setDebug, setName, setOption, setOption, setPermissions, setPermissions, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Map<String,List<PermissionGroup>> cachedGroups
protected Map<String,String[]> cachedPermissions
protected Map<String,String> cachedPrefix
protected Map<String,String> cachedSuffix
protected HashMap<String,String> cachedAnwsers
protected HashMap<String,String> cachedOptions
Constructor Detail |
---|
public PermissionUser(String playerName, PermissionManager manager)
Method Detail |
---|
public void initialize()
PermissionEntity
initialize
in class PermissionEntity
public String getOwnPrefix()
public abstract String getOwnPrefix(String worldName)
public final String getOwnSuffix()
public abstract String getOwnSuffix(String worldName)
public abstract String[] getOwnPermissions(String world)
world
- world's name
public String getOption(String optionName, String worldName, String defaultValue)
PermissionEntity
getOption
in class PermissionEntity
optionName
- Name of optionworldName
- World to look fordefaultValue
- Default value to fallback if no such option was found
public abstract String getOwnOption(String option, String world, String defaultValue)
option
- option stringworld
- world's namedefaultValue
- default value
public String getOwnOption(String option)
option
-
public String getOwnOption(String option, String world)
public int getOwnOptionInteger(String optionName, String world, int defaultValue)
public boolean getOwnOptionBoolean(String optionName, String world, boolean defaultValue)
public double getOwnOptionDouble(String optionName, String world, double defaultValue)
protected abstract String[] getGroupsNamesImpl(String worldName)
public PermissionGroup[] getGroups()
public PermissionGroup[] getGroups(String worldName)
worldName
- Name of world
public Map<String,PermissionGroup[]> getAllGroups()
protected PermissionGroup[] getWorldGroups(String worldName)
public String[] getGroupsNames()
public String[] getGroupsNames(String worldName)
public abstract void setGroups(String[] groups, String worldName)
groups
- array of parent group namespublic void setGroups(String[] groups)
public void setGroups(PermissionGroup[] parentGroups, String worldName)
groups
- array of parent group objectspublic void setGroups(PermissionGroup[] parentGroups)
public void addGroup(String groupName, String worldName)
groupName
- group's name as Stringpublic void addGroup(String groupName)
public void addGroup(PermissionGroup group, String worldName)
group
- as PermissionGroup objectpublic void addGroup(PermissionGroup group)
public void removeGroup(String groupName, String worldName)
groupName
- group's name as Stringpublic void removeGroup(String groupName)
public void removeGroup(PermissionGroup group, String worldName)
group
- group as PermissionGroup objectpublic void removeGroup(PermissionGroup group)
public boolean inGroup(PermissionGroup group, String worldName, boolean checkInheritance)
group
- group as PermissionGroup objectworldName
- checkInheritance
- if true then descendant groups of the given group would be checked too
public boolean inGroup(PermissionGroup group, boolean checkInheritance)
public boolean inGroup(String groupName, String worldName, boolean checkInheritance)
groupName
- group's name to checkworldName
- checkInheritance
- if true than descendant groups of specified group would be checked too
public boolean inGroup(String groupName, boolean checkInheritance)
public boolean inGroup(PermissionGroup group, String worldName)
group
- worldName
-
public boolean inGroup(PermissionGroup group)
public boolean inGroup(String groupName, String worldName)
group
- group's name
public boolean inGroup(String groupName)
public PermissionGroup promote(PermissionUser promoter, String ladderName) throws RankingException
promoter
- null if action is performed from console or by a pluginladderName
- Ladder name
RankingException
public PermissionGroup demote(PermissionUser demoter, String ladderName) throws RankingException
promoter
- Specify null if action performed from console or by pluginladderName
-
RankingException
public boolean isRanked(String ladder)
ladder
- Ladder name
public int getRank(String ladder)
ladder
- Ladder name
public PermissionGroup getRankLadderGroup(String ladder)
ladder
- Ladder name
public Map<String,PermissionGroup> getRankLadders()
public String[] getPermissions(String worldName)
PermissionEntity
getPermissions
in class PermissionEntity
worldName
- World name
public void addPermission(String permission, String worldName)
PermissionEntity
addPermission
in class PermissionEntity
permission
- Permission to addworldName
- World name to add permission topublic void removePermission(String permission, String worldName)
PermissionEntity
removePermission
in class PermissionEntity
permission
- Permission to removeprotected void getInheritedPermissions(String worldName, List<String> permissions, boolean groupInheritance, boolean worldInheritance)
public void addTimedPermission(String permission, String world, int lifeTime)
PermissionEntity
addTimedPermission
in class PermissionEntity
lifeTime
- Lifetime of permission in seconds. 0 for transient permission (world disappear only after server reload)public void removeTimedPermission(String permission, String world)
PermissionEntity
removeTimedPermission
in class PermissionEntity
protected int getPromoterRankAndCheck(PermissionUser promoter, String ladderName) throws RankingException
RankingException
protected void swapGroups(PermissionGroup src, PermissionGroup dst)
public String getPrefix(String worldName)
PermissionEntity
getPrefix
in class PermissionEntity
public boolean has(String permission)
PermissionEntity
has
in class PermissionEntity
permission
- Permission to check
public String getSuffix(String worldName)
PermissionEntity
getSuffix
in class PermissionEntity
public String getMatchingExpression(String permission, String world)
getMatchingExpression
in class PermissionEntity
protected void clearCache()
public void setPrefix(String prefix, String worldName)
PermissionEntity
setPrefix
in class PermissionEntity
prefix
- new prefixpublic void setSuffix(String postfix, String worldName)
PermissionEntity
setSuffix
in class PermissionEntity
postfix
- new suffixpublic void remove()
PermissionEntity
remove
in class PermissionEntity
public void save()
PermissionEntity
save
in class PermissionEntity
public boolean explainExpression(String expression)
explainExpression
in class PermissionEntity
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |