Documentation ¶
Index ¶
- Constants
- Variables
- type AddBanResponse
- type BanConfig
- type BanFlag
- type BanInfo
- type BanResult
- type ChangePermResponse
- type ChangePermResult
- type CheckTokenResponse
- type CreateTokenResponse
- type CymaticScanConfig
- type EntityType
- func (e EntityType) IsAdmin() bool
- func (e EntityType) IsAdminStr() string
- func (e EntityType) IsBot() bool
- func (e EntityType) IsBotStr() string
- func (e EntityType) IsChannel() bool
- func (e EntityType) IsChannelStr() string
- func (e EntityType) IsChat() bool
- func (e EntityType) IsChatStr() string
- func (e EntityType) IsGroup() bool
- func (e EntityType) IsGroupStr() string
- func (e EntityType) IsOwner() bool
- func (e EntityType) IsOwnerOrAdmin() bool
- func (e EntityType) IsOwnerOrAdminStr() string
- func (e EntityType) IsOwnerStr() string
- func (e EntityType) IsUser() bool
- func (e EntityType) IsUserStr() string
- func (e EntityType) ToString() string
- type FullRevertConfig
- type FullRevertResponse
- type GeneralInfoResponse
- type GeneralInfoResult
- type GetBansResponse
- type GetBansResult
- type GetInfoResponse
- type GetInfoResult
- func (r *GetInfoResult) EstimateCrimeCoefficient() string
- func (r *GetInfoResult) EstimateCrimeCoefficientSep() (string, string)
- func (r *GetInfoResult) FormatCuteFlags() mdparser.WMarkDown
- func (r *GetInfoResult) FormatFlags() mdparser.WMarkDown
- func (r *GetInfoResult) GetDateAsShort() string
- func (r *GetInfoResult) GetStringCrimeCoefficient() string
- func (r *GetInfoResult) HasCustomFlag() bool
- func (r *GetInfoResult) IsPerma() bool
- func (r *GetInfoResult) SetAsBanReason(reason string)
- type GetRegisteredResponse
- type GetRegisteredResult
- type GetStatsResponse
- type GetStatsResult
- type GetTokenResponse
- type GetUpdateResponse
- type PollingIdentifier
- type PollingUniqueId
- type RemoveBanResponse
- type ReportConfig
- type ReportResponse
- type RevertConfig
- type RevokeTokenResponse
- type ScanConfig
- type ScanRequestApprovedUpdate
- type ScanRequestRejectedUpdate
- type ServerUpdateContainer
- type ServerUpdateHandler
- type SibylClient
- type SibylConfig
- type SibylDispatcher
- func (d *SibylDispatcher) AddHandler(uType SibylUpdateType, h ServerUpdateHandler)
- func (d *SibylDispatcher) Listen()
- func (d *SibylDispatcher) SetOnGetUpdateFailed(fn func(error))
- func (d *SibylDispatcher) SetOnHandlerError(fn func(error))
- func (d *SibylDispatcher) SetOnStartFailed(fn func(error))
- func (d *SibylDispatcher) StartListening()
- type SibylError
- type SibylUpdateContext
- type SibylUpdateType
- type StartPollingResponse
- type TokenInfo
- func (t *TokenInfo) IsCitizen() bool
- func (t *TokenInfo) IsEnforcer() bool
- func (t *TokenInfo) IsExpired(d time.Duration) bool
- func (t *TokenInfo) IsInspector() bool
- func (t *TokenInfo) IsOwner() bool
- func (t *TokenInfo) IsRegistered() bool
- func (t *TokenInfo) IsValid() bool
- func (t *TokenInfo) SetCachedTime(tCache time.Time)
- type UserPermission
- func (p UserPermission) CanBan() bool
- func (p UserPermission) CanBeBanned() bool
- func (p UserPermission) CanBeReported() bool
- func (p UserPermission) CanChangePermission(pre, target UserPermission) bool
- func (p UserPermission) CanCreateToken() bool
- func (p UserPermission) CanGetAllBans() bool
- func (p UserPermission) CanGetGeneralInfo() bool
- func (p UserPermission) CanGetRegisteredList() bool
- func (p UserPermission) CanGetStats() bool
- func (p UserPermission) CanGetToken() bool
- func (p UserPermission) CanReport() bool
- func (p UserPermission) CanRevokeToken() bool
- func (p UserPermission) CanSeeStats() bool
- func (p UserPermission) CanTryChangePermission(direct bool) bool
- func (p UserPermission) HasRole() bool
- func (p UserPermission) IsEnforcer() bool
- func (p UserPermission) IsInspector() bool
- func (p UserPermission) IsOwner() bool
- func (p UserPermission) IsRegistered() bool
Constants ¶
const ( UpdateTypeScanRequestApproved = "scan_request_approved" UpdateTypeScanRequestRejected = "scan_request_rejected" )
const ( BanFlagTrolling = "TROLLING" BanFlagSpam = "SPAM" BanFlagEvade = "EVADE" BanFlagCustom = "CUSTOM" BanFlagPsychoHazard = "PSYCHOHAZARD" BanFlagMalImp = "MALIMP" BanFlagNSFW = "NSFW" BanFlagRaid = "RAID" BanFlagSpamBot = "SPAMBOT" BanFlagMassAdd = "MASSADD" )
flags constants
const (
DefaultDispatcherTimeout = 30
)
const (
DefaultUrl = "https://psychopass.kaizoku.cyou/"
)
Variables ¶
var ( ErrInvalidHostUrl = errors.New("invalid host url") ErrInvalidToken = errors.New("token length should be more than 20") ErrNoReason = errors.New("reason is required for this action") )
error variables
Functions ¶
This section is empty.
Types ¶
type AddBanResponse ¶
type AddBanResponse struct { Success bool `json:"success"` Result *BanResult `json:"result"` Error *SibylError `json:"error"` }
type BanConfig ¶ added in v1.0.5
type BanConfig = CymaticScanConfig
type BanInfo ¶
type BanInfo struct { UserId int64 `json:"user_id"` Banned bool `json:"banned"` Reason string `json:"reason"` Message string `json:"message"` BanSourceUrl string `json:"ban_source_url"` BannedBy int64 `json:"banned_by"` CrimeCoefficient int64 `json:"crime_coefficient"` Date string `json:"date"` BanFlags []string `json:"ban_flags"` TargetType EntityType `json:"target_type"` }
type ChangePermResponse ¶
type ChangePermResponse struct { Success bool `json:"success"` Result *ChangePermResult `json:"result"` Error *SibylError `json:"error"` }
type ChangePermResult ¶
type ChangePermResult struct { PreviousPerm UserPermission `json:"previous_perm"` CurrentPerm UserPermission `json:"current_perm"` }
type CheckTokenResponse ¶
type CheckTokenResponse struct { Success bool `json:"success"` Result bool `json:"result"` Error *SibylError `json:"error"` }
type CreateTokenResponse ¶
type CreateTokenResponse struct { Success bool `json:"success"` Result *TokenInfo `json:"result"` Error *SibylError `json:"error"` }
type CymaticScanConfig ¶ added in v1.0.6
type CymaticScanConfig struct { Message string SrcUrl string TargetType EntityType TheToken string PollingId *PollingIdentifier }
type EntityType ¶ added in v1.0.6
type EntityType int
const ( // EntityTypeUser represents a normal user while being scanned. // please notice that "being normal", doesn't necessarily mean // not being criminal. EntityTypeUser EntityType = iota // EntityTypeBot represents an account which is considered as a bot. // as API has no idea what is a "bot account", the value "is_bot" // should be set by the enforcer/inspector while sending requests // to sibyl. EntityTypeBot // EntityTypeAdmin represents an account which is considered as an admin // in a psychohazard event. it's completely up to the person who is scanning // to decide what is an admin account. EntityTypeAdmin // EntityTypeOwner represents an account which is considered as an owner // in a psychohazard event. it's completely up to the person who is scanning // to decide what is an owner account. EntityTypeOwner // EntityTypeChannel represents an entity which is considered as a channel. EntityTypeChannel // EntityTypeGroup represents an entity which is considered as a group. EntityTypeGroup )
func (EntityType) IsAdmin ¶ added in v1.0.6
func (e EntityType) IsAdmin() bool
func (EntityType) IsAdminStr ¶ added in v1.0.6
func (e EntityType) IsAdminStr() string
func (EntityType) IsBot ¶ added in v1.0.6
func (e EntityType) IsBot() bool
func (EntityType) IsBotStr ¶ added in v1.0.6
func (e EntityType) IsBotStr() string
func (EntityType) IsChannel ¶ added in v1.0.6
func (e EntityType) IsChannel() bool
func (EntityType) IsChannelStr ¶ added in v1.0.6
func (e EntityType) IsChannelStr() string
func (EntityType) IsChat ¶ added in v1.0.6
func (e EntityType) IsChat() bool
func (EntityType) IsChatStr ¶ added in v1.0.6
func (e EntityType) IsChatStr() string
func (EntityType) IsGroup ¶ added in v1.0.6
func (e EntityType) IsGroup() bool
func (EntityType) IsGroupStr ¶ added in v1.0.6
func (e EntityType) IsGroupStr() string
func (EntityType) IsOwner ¶ added in v1.0.6
func (e EntityType) IsOwner() bool
func (EntityType) IsOwnerOrAdmin ¶ added in v1.0.6
func (e EntityType) IsOwnerOrAdmin() bool
func (EntityType) IsOwnerOrAdminStr ¶ added in v1.0.6
func (e EntityType) IsOwnerOrAdminStr() string
func (EntityType) IsOwnerStr ¶ added in v1.0.6
func (e EntityType) IsOwnerStr() string
func (EntityType) IsUser ¶ added in v1.0.6
func (e EntityType) IsUser() bool
func (EntityType) IsUserStr ¶ added in v1.0.6
func (e EntityType) IsUserStr() string
func (EntityType) ToString ¶ added in v1.0.6
func (e EntityType) ToString() string
type FullRevertConfig ¶ added in v1.0.15
type FullRevertConfig struct {
TheToken string
}
type FullRevertResponse ¶ added in v1.0.15
type FullRevertResponse struct { Success bool `json:"success"` Result string `json:"result"` Error *SibylError `json:"error"` }
type GeneralInfoResponse ¶ added in v1.0.4
type GeneralInfoResponse struct { Success bool `json:"success"` Result *GeneralInfoResult `json:"result"` Error *SibylError `json:"error"` }
type GeneralInfoResult ¶ added in v1.0.4
type GetBansResponse ¶
type GetBansResponse struct { Success bool `json:"success"` Result *GetBansResult `json:"result"` Error *SibylError `json:"error"` }
type GetBansResult ¶
type GetBansResult struct {
Users []BanInfo `json:"users"`
}
type GetInfoResponse ¶
type GetInfoResponse struct { Success bool `json:"success"` Result *GetInfoResult `json:"result"` Error *SibylError `json:"error"` }
type GetInfoResult ¶
type GetInfoResult struct { UserId int64 `json:"user_id"` Banned bool `json:"banned"` Reason string `json:"reason"` Message string `json:"message"` BanSourceUrl string `json:"ban_source_url"` BannedBy int64 `json:"banned_by"` CrimeCoefficient int `json:"crime_coefficient"` Date string `json:"date"` BanFlags []BanFlag `json:"ban_flags"` TargetType EntityType `json:"target_type"` }
func (*GetInfoResult) EstimateCrimeCoefficient ¶ added in v1.0.6
func (r *GetInfoResult) EstimateCrimeCoefficient() string
func (*GetInfoResult) EstimateCrimeCoefficientSep ¶ added in v1.0.6
func (r *GetInfoResult) EstimateCrimeCoefficientSep() (string, string)
func (*GetInfoResult) FormatCuteFlags ¶ added in v1.0.6
func (r *GetInfoResult) FormatCuteFlags() mdparser.WMarkDown
func (*GetInfoResult) FormatFlags ¶ added in v1.0.6
func (r *GetInfoResult) FormatFlags() mdparser.WMarkDown
func (*GetInfoResult) GetDateAsShort ¶ added in v1.0.6
func (r *GetInfoResult) GetDateAsShort() string
func (*GetInfoResult) GetStringCrimeCoefficient ¶ added in v1.0.6
func (r *GetInfoResult) GetStringCrimeCoefficient() string
func (*GetInfoResult) HasCustomFlag ¶ added in v1.0.6
func (r *GetInfoResult) HasCustomFlag() bool
func (*GetInfoResult) IsPerma ¶ added in v1.0.6
func (r *GetInfoResult) IsPerma() bool
func (*GetInfoResult) SetAsBanReason ¶ added in v1.0.6
func (r *GetInfoResult) SetAsBanReason(reason string)
type GetRegisteredResponse ¶
type GetRegisteredResponse struct { Success bool `json:"success"` Result *GetRegisteredResult `json:"result"` Error *SibylError `json:"error"` }
type GetRegisteredResult ¶
type GetRegisteredResult struct {
RegisteredUsers []int64 `json:"registered_users"`
}
type GetStatsResponse ¶
type GetStatsResponse struct { Success bool `json:"success"` Result *GetStatsResult `json:"result"` Error *SibylError `json:"error"` }
type GetStatsResult ¶
type GetStatsResult struct { BannedCount int64 `json:"banned_count"` TrollingBanCount int64 `json:"trolling_ban_count"` SpamBanCount int64 `json:"spam_ban_count"` EvadeBanCount int64 `json:"evade_ban_count"` CustomBanCount int64 `json:"custom_ban_count"` PsychoHazardBanCount int64 `json:"psycho_hazard_ban_count"` MalImpBanCount int64 `json:"mal_imp_ban_count"` NSFWBanCount int64 `json:"nsfw_ban_count"` SpamBotBanCount int64 `json:"spam_bot_ban_count"` RaidBanCount int64 `json:"raid_ban_count"` MassAddBanCount int64 `json:"mass_add_ban_count"` CloudyCount int64 `json:"cloudy_count"` TokenCount int64 `json:"token_count"` InspectorsCount int64 `json:"inspectors_count"` EnforcesCount int64 `json:"enforces_count"` }
type GetTokenResponse ¶
type GetTokenResponse struct { Success bool `json:"success"` Result *TokenInfo `json:"result"` Error *SibylError `json:"error"` }
type GetUpdateResponse ¶ added in v1.0.10
type GetUpdateResponse struct { Success bool `json:"success"` Result *ServerUpdateContainer `json:"result"` Error *SibylError `json:"error"` }
type PollingIdentifier ¶ added in v1.0.12
type PollingIdentifier struct { PollingUniqueId PollingUniqueId `json:"polling_unique_id"` PollingAccessHash string `json:"polling_access_hash"` }
PollingIdentifier represents a unique polling identifier.
func (*PollingIdentifier) IsInvalid ¶ added in v1.0.12
func (p *PollingIdentifier) IsInvalid() bool
type PollingUniqueId ¶ added in v1.0.12
type PollingUniqueId uint64
type RemoveBanResponse ¶
type RemoveBanResponse struct { Success bool `json:"success"` Result string `json:"result"` Error *SibylError `json:"error"` }
type ReportConfig ¶ added in v1.0.5
type ReportConfig = CymaticScanConfig
type ReportResponse ¶
type ReportResponse struct { Success bool `json:"success"` Result string `json:"result"` Error *SibylError `json:"error"` }
type RevertConfig ¶ added in v1.0.13
type RevertConfig = CymaticScanConfig
type RevokeTokenResponse ¶
type RevokeTokenResponse struct { Success bool `json:"success"` Result *TokenInfo `json:"result"` Error *SibylError `json:"error"` }
type ScanConfig ¶ added in v1.0.6
type ScanConfig = ReportConfig
type ScanRequestApprovedUpdate ¶ added in v1.0.10
type ScanRequestApprovedUpdate struct { UniqueId string `json:"unique_id"` TargetUser int64 `json:"target_user"` TargetType EntityType `json:"target_type"` AgentReason string `json:"agent_reason"` }
type ScanRequestRejectedUpdate ¶ added in v1.0.10
type ScanRequestRejectedUpdate struct { UniqueId string `json:"unique_id"` TargetUser int64 `json:"target_user"` TargetType EntityType `json:"target_type"` AgentReason string `json:"agent_reason"` }
type ServerUpdateContainer ¶ added in v1.0.10
type ServerUpdateContainer struct { UpdateType SibylUpdateType `json:"update_type"` UpdateData json.RawMessage `json:"update_data"` }
type ServerUpdateHandler ¶ added in v1.0.10
type ServerUpdateHandler func(client SibylClient, ctx *SibylUpdateContext) error
type SibylClient ¶
type SibylClient interface { // ChangeToken changes token of the current SibylClient. // returns error if any. ChangeToken(token string) error // ChangeUrl changes host url of the current SibylClient. ChangeUrl(hostUrl string) error // ChangeToDefaultUrl changes host url of the current SibylClient to default url. ChangeToDefaultUrl() // GetHostUrl returns host url of the current SibylClient. GetHostUrl() string // Ban bans user with given id, reason and BanConfig. Ban(userId int64, reason string, config *BanConfig) (*BanResult, error) // BanUser bans a "user" with given id, reason and BanConfig. // entityType will be set to "user". BanUser(userId int64, reason string, config *BanConfig) (*BanResult, error) // BanBot bans a "bot" with given id, reason and BanConfig. // entityType will be set to "bot". BanBot(userId int64, reason string, config *BanConfig) (*BanResult, error) // RemoveBan removes ban from user with given id. RemoveBan(userId int64, reason string, config *RevertConfig) (string, error) // RevertBan reverts the ban from user with given id. RevertBan(userId int64, reason string, config *RevertConfig) (string, error) // FullRevert will fully revert the target user, they won't get `Restored` status, // all of their bans history will be deleted. // This method requires high token permission. FullRevert(userId int64, config *FullRevertConfig) (string, error) // GetInfo returns information about the user with given id. GetInfo(userId int64) (*GetInfoResult, error) // GetGeneralInfo returns information about the user with given id. // if the user is not a registered user at PSB, server will return error. GetGeneralInfo(userId int64) (*GeneralInfoResult, error) // GetGetAllBannedUsers returns information about all banned users. GetGetAllBannedUsers() (*GetBansResult, error) // GetStats returns current server stats. GetStats() (*GetStatsResult, error) // CheckToken checks if the token is valid. CheckToken() (bool, error) // Report reports a user with given id, reason and ReportConfig. Report(userId int64, reason string, config *ReportConfig) (string, error) // Scan scans a user with given id, reason and ReportConfig. Scan(userId int64, reason string, config *ReportConfig) (string, error) // ReportUser reports a "user" with given id, reason and ReportConfig. // IsBot parameter will be set to false. ReportUser(userId int64, reason string, config *ReportConfig) (string, error) // ScanUser scans a "user" with given id, reason and ReportConfig. // IsBot parameter will be set to false. ScanUser(userId int64, reason string, config *ReportConfig) (string, error) // ReportBot reports a "bot" with given id, reason and ReportConfig. // IsBot parameter will be set to true. ReportBot(userId int64, reason string, config *ReportConfig) (string, error) // CreateToken creates a new token in the server-side. CreateToken(userId int64) (*TokenInfo, error) // ChangePermission changes permission of the user with given id. ChangePermission(userId int64, perm UserPermission) (*ChangePermResult, error) // RevokeToken revokes the token of the user with given id. // It needs owner permission if the user-id doesn't belong to yourself. RevokeToken(userId int64) (*TokenInfo, error) // GetToken returns the token of the user with given id. // it needs owner permission if the user-id doesn't belong to yourself. GetToken(userId int64) (*TokenInfo, error) // GetAllRegisteredUsers returns information about all registered users. GetAllRegisteredUsers() (*GetRegisteredResult, error) // StartPolling method will sends a new StartPolling request to the server. // as of now, this method can only be used by users with permission more than // inspector. this method will return the unique id of the polling process. // later on, for getting updates from server, you should pass this unique-id. StartPolling() (*PollingIdentifier, error) // GetUpdates will send a GetUpdates request to the sibyl's servers, the response // might be (nil, nil), which means getting data got timed out. normally, you have // to call this method consequently if you want to remain up-to-date with server's // events. preferably, pass the unique-id you have got from StartPolling method as // second arg (second arg is not mandatory, and can be set to 0). GetUpdates(timeout int, uniqueId *PollingIdentifier) (*ServerUpdateContainer, error) // String returns string representation of the current SibylClient. String() string // Println prints string representation of the current SibylClient using fmt.Println. Println() // Print prints string representation of the current SibylClient using fmt.Print. Print() }
func NewClient ¶
func NewClient(token string, config *SibylConfig) SibylClient
type SibylConfig ¶
func GetDefaultConfig ¶
func GetDefaultConfig() *SibylConfig
type SibylDispatcher ¶ added in v1.0.10
type SibylDispatcher struct { PollingId *PollingIdentifier TimeoutSeconds int MaxConnectionTries int // contains filtered or unexported fields }
func GetNewDispatcher ¶ added in v1.0.10
func GetNewDispatcher(client SibylClient) *SibylDispatcher
func (*SibylDispatcher) AddHandler ¶ added in v1.0.10
func (d *SibylDispatcher) AddHandler(uType SibylUpdateType, h ServerUpdateHandler)
func (*SibylDispatcher) Listen ¶ added in v1.0.10
func (d *SibylDispatcher) Listen()
func (*SibylDispatcher) SetOnGetUpdateFailed ¶ added in v1.0.10
func (d *SibylDispatcher) SetOnGetUpdateFailed(fn func(error))
func (*SibylDispatcher) SetOnHandlerError ¶ added in v1.0.10
func (d *SibylDispatcher) SetOnHandlerError(fn func(error))
func (*SibylDispatcher) SetOnStartFailed ¶ added in v1.0.10
func (d *SibylDispatcher) SetOnStartFailed(fn func(error))
func (*SibylDispatcher) StartListening ¶ added in v1.0.10
func (d *SibylDispatcher) StartListening()
type SibylError ¶
type SibylError struct { Code int `json:"code"` Message string `json:"message"` Origin string `json:"origin"` Date string `json:"date"` }
func ToSibylError ¶
func ToSibylError(err error) *SibylError
func (*SibylError) Error ¶
func (e *SibylError) Error() string
type SibylUpdateContext ¶ added in v1.0.10
type SibylUpdateContext struct { ScanRequestApproved *ScanRequestApprovedUpdate ScanRequestRejected *ScanRequestApprovedUpdate }
type SibylUpdateType ¶ added in v1.0.10
type SibylUpdateType string
type StartPollingResponse ¶ added in v1.0.10
type StartPollingResponse struct { Success bool `json:"success"` Result *PollingIdentifier `json:"result"` Error *SibylError `json:"error"` }
type TokenInfo ¶
type TokenInfo struct { UserId int64 `json:"user_id" gorm:"primaryKey"` Hash string `json:"hash"` Permission UserPermission `json:"permission"` CreatedAt string `json:"created_at"` AcceptedReports int `json:"accepted_reports"` DeniedReports int `json:"denied_reports"` AssignedBy int64 `json:"assigned_by"` DivisionNum int `json:"division_num"` AssignedReason string `json:"assigned_reason"` // contains filtered or unexported fields }
func (*TokenInfo) IsEnforcer ¶ added in v1.0.4
func (*TokenInfo) IsInspector ¶ added in v1.0.4
func (*TokenInfo) IsRegistered ¶ added in v1.0.4
func (*TokenInfo) SetCachedTime ¶ added in v1.0.1
type UserPermission ¶
type UserPermission int
const ( // NormalUser Can read from the Sibyl System. NormalUser UserPermission = iota // Enforcer Can only report to the Sibyl System. Enforcer // Inspector Can read/write directly to the Sibyl System. Inspector // Owner Can create/revoke tokens. Owner )
func (UserPermission) CanBan ¶ added in v1.0.5
func (p UserPermission) CanBan() bool
CanBan returns true if the token with its current permission can ban/unban a user from Sibyl System or not.
func (UserPermission) CanBeBanned ¶ added in v1.0.5
func (p UserPermission) CanBeBanned() bool
CanBeBanned returns true if the token with its current permission can be banned on sibyl system or not.
func (UserPermission) CanBeReported ¶ added in v1.0.5
func (p UserPermission) CanBeReported() bool
CanBeReported returns true if the token with its current permission can be reported to sibyl system or not.
func (UserPermission) CanChangePermission ¶ added in v1.0.5
func (p UserPermission) CanChangePermission(pre, target UserPermission) bool
CanChangePermission returns true if the token with its current permission can change permission of another tokens or not.
func (UserPermission) CanCreateToken ¶ added in v1.0.5
func (p UserPermission) CanCreateToken() bool
CanCreateToken returns true if the token with its current permission can create tokens in Sibyl System or not.
func (UserPermission) CanGetAllBans ¶ added in v1.0.5
func (p UserPermission) CanGetAllBans() bool
CanGetAllBans returns true if the token with its current permission can get all the banned users.
func (UserPermission) CanGetGeneralInfo ¶ added in v1.0.5
func (p UserPermission) CanGetGeneralInfo() bool
CanGetGeneralInfo returns true if the token with its current permission can get general info of a registered user using their id or not.
func (UserPermission) CanGetRegisteredList ¶ added in v1.0.5
func (p UserPermission) CanGetRegisteredList() bool
CanGetRegisteredList returns true if the token with its current permission can get all the registered users.
func (UserPermission) CanGetStats ¶ added in v1.0.5
func (p UserPermission) CanGetStats() bool
CanGetStats returns true if the token with its current permission can get all stats of sibyl system or not.
func (UserPermission) CanGetToken ¶ added in v1.0.5
func (p UserPermission) CanGetToken() bool
CanGetToken returns true if the token with its current permission can get the token of another user using their id or not.
func (UserPermission) CanReport ¶ added in v1.0.5
func (p UserPermission) CanReport() bool
CanReport returns true if the token with its current permission can report a user to sibyl system or not.
func (UserPermission) CanRevokeToken ¶ added in v1.0.5
func (p UserPermission) CanRevokeToken() bool
CanRevokeToken returns true if the token with its current permission can revoke tokens in Sibyl System or not.
func (UserPermission) CanSeeStats ¶ added in v1.0.5
func (p UserPermission) CanSeeStats() bool
CanSeeStats returns true if the token with its current permission can see stats of another tokens or not.
func (UserPermission) CanTryChangePermission ¶ added in v1.0.5
func (p UserPermission) CanTryChangePermission(direct bool) bool
CanTryChangePermission returns true if the token with its current permission can try to change permission of another tokens or not.
func (UserPermission) HasRole ¶ added in v1.0.5
func (p UserPermission) HasRole() bool
HasRole returns true if and only if this token belongs to a user which has a role in the Sibyl System (is not a normal user).
func (UserPermission) IsEnforcer ¶ added in v1.0.5
func (p UserPermission) IsEnforcer() bool
IsEnforcer returns true if the token's permission is enforcer.
func (UserPermission) IsInspector ¶ added in v1.0.5
func (p UserPermission) IsInspector() bool
IsInspector returns true if the token's permission is inspector.
func (UserPermission) IsOwner ¶ added in v1.0.5
func (p UserPermission) IsOwner() bool
IsOwner returns true if the token's permission is owner.
func (UserPermission) IsRegistered ¶ added in v1.0.5
func (p UserPermission) IsRegistered() bool
IsRegistered returns true if the owner of this token is considered as a valid registered user in the system.