class PrivateParlorXT::AuthorizedRanks
- PrivateParlorXT::AuthorizedRanks
- Reference
- Object
Overview
A handler for Rank
and determines if a Rank
has access to certain commands and message types
Defined in:
private-parlor-xt/ranks/authorized_ranks.crConstructors
-
.new(ranks : Hash(Int32, Rank))
Creates an instance of
AuthorizedRanks
Instance Method Summary
-
#authorized?(user_rank : Int32, permission : CommandPermissions) : Bool | Nil
Returns
true
if user rank has the given command permission; user is authorized. -
#authorized?(user_rank : Int32, permission : MessagePermissions) : Bool | Nil
Returns
true
if user rank has the given message permission; user is authorized. -
#authorized?(user_rank : Int32, *permissions : CommandPermissions) : CommandPermissions | Nil
Returns the first symbol found from intersecting the user command permissions and the given permissions; user is authorized.
-
#can_demote?(rank : Int32, invoker : Int32, receiver : Int32) : Bool
Returns
true
if the user to be demoted (receiver) can be demoted with the given rank. -
#can_promote?(rank : Int32, invoker : Int32, receiver : Int32, permission : CommandPermissions) : Bool
Returns true if the user to be promoted (receiver) can be promoted with the given rank.
-
#can_ranksay?(rank : Int32, invoker : Int32, invoker_permission : CommandPermissions, rank_permission : CommandPermissions | Nil = nil) : Bool
Returns
true
if the user can sign a message with the given rank. -
#find_rank(name : String, value : Int32 | Nil = nil) : Tuple(Int32, Rank) | Nil
Finds a rank from a given rank value or iterates through the ranks hash for a rank with a given name
-
#max_rank : Int32
Returns the max rank value in the ranks hash
-
#rank_name(rank_value : Int32) : String | Nil
Returns the rank name associated with the given value.
-
#rank_names(limit : Int32) : Array(String)
Returns an array of all the rank names in the ranks hash, up to a rank value limit and excluding the blacklisted (-10) rank
-
#rank_names : Array(String)
Returns an array of all the rank names in the ranks hash.
- #ranks : Hash(Int32, Rank)
-
#ranksay(rank : String) : String
Converts the given rank string into a string that can be used for a
RanksayCommand
, preceding the '-say' substring -
#ranksay_ranks : Array(String)
Return an array of rank names that have a
CommandPermissions::Ranksay
orCommandPermissions::RanksayLower
permission
Constructor Detail
Instance Method Detail
Returns true
if user rank has the given command permission; user is authorized.
Returns false
otherwise, or nil
if the user rank does not exist in #ranks
Returns true
if user rank has the given message permission; user is authorized.
Returns false
otherwise, or nil
if the user rank does not exist in #ranks
Returns the first symbol found from intersecting the user command permissions and the given permissions; user is authorized.
Returnsnil
if the user rank does not exist in #ranks
or if the rank does not have any of the given permissions.
Used for checking groups of command permissions that are similar.
Returns true
if the user to be demoted (receiver) can be demoted with the given rank.
Returns true if the user to be promoted (receiver) can be promoted with the given rank.
Returns true
if the user can sign a message with the given rank.
Finds a rank from a given rank value or iterates through the ranks hash for a rank with a given name
Returns a 2-tuple with the rank value and the rank associated with that rank,
or nil
if no rank exists with the given values.
Returns the rank name associated with the given value.
Returns an array of all the rank names in the ranks hash, up to a rank value limit and excluding the blacklisted (-10) rank
Converts the given rank string into a string that can be used for a RanksayCommand
, preceding the '-say' substring
Return an array of rank names that have a CommandPermissions::Ranksay
or CommandPermissions::RanksayLower
permission