mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-12-30 00:21:16 +00:00
[core] Allow plugins to evaluate whether permissions are available
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
a06d8fa1cd
commit
29ce8820bf
2 changed files with 9 additions and 0 deletions
|
@ -33,6 +33,9 @@ type (
|
||||||
|
|
||||||
ActorDocumentationRegistrationFunc func(ActionDocumentation)
|
ActorDocumentationRegistrationFunc func(ActionDocumentation)
|
||||||
|
|
||||||
|
ChannelPermissionCheckFunc func(channel string, scopes ...string) (bool, error)
|
||||||
|
ChannelAnyPermissionCheckFunc func(channel string, scopes ...string) (bool, error)
|
||||||
|
|
||||||
CronRegistrationFunc func(spec string, cmd func()) (cron.EntryID, error)
|
CronRegistrationFunc func(spec string, cmd func()) (cron.EntryID, error)
|
||||||
|
|
||||||
EventHandlerFunc func(evt string, eventData *FieldCollection) error
|
EventHandlerFunc func(evt string, eventData *FieldCollection) error
|
||||||
|
@ -64,6 +67,10 @@ type (
|
||||||
GetTwitchClient func() *twitch.Client
|
GetTwitchClient func() *twitch.Client
|
||||||
// GetTwitchClientForChannel retrieves a fully configured Twitch client with initialized cache for extended permission channels
|
// GetTwitchClientForChannel retrieves a fully configured Twitch client with initialized cache for extended permission channels
|
||||||
GetTwitchClientForChannel func(string) (*twitch.Client, error)
|
GetTwitchClientForChannel func(string) (*twitch.Client, error)
|
||||||
|
// HasAnyPermissionForChannel checks whether ANY of the given permissions were granted for the given channel
|
||||||
|
HasAnyPermissionForChannel ChannelAnyPermissionCheckFunc
|
||||||
|
// HasPermissionForChannel checks whether ALL of the given permissions were granted for the given channel
|
||||||
|
HasPermissionForChannel ChannelPermissionCheckFunc
|
||||||
// RegisterActor is used to register a new IRC rule-actor implementing the Actor interface
|
// RegisterActor is used to register a new IRC rule-actor implementing the Actor interface
|
||||||
RegisterActor ActorRegistrationFunc
|
RegisterActor ActorRegistrationFunc
|
||||||
// RegisterActorDocumentation is used to register an ActorDocumentation for the config editor
|
// RegisterActorDocumentation is used to register an ActorDocumentation for the config editor
|
||||||
|
|
|
@ -126,6 +126,8 @@ func getRegistrationArguments() plugins.RegistrationArguments {
|
||||||
GetDatabaseConnector: func() database.Connector { return db },
|
GetDatabaseConnector: func() database.Connector { return db },
|
||||||
GetLogger: func(moduleName string) *log.Entry { return log.WithField("module", moduleName) },
|
GetLogger: func(moduleName string) *log.Entry { return log.WithField("module", moduleName) },
|
||||||
GetTwitchClient: func() *twitch.Client { return twitchClient },
|
GetTwitchClient: func() *twitch.Client { return twitchClient },
|
||||||
|
HasAnyPermissionForChannel: accessService.HasAnyPermissionForChannel,
|
||||||
|
HasPermissionForChannel: accessService.HasPermissionsForChannel,
|
||||||
RegisterActor: registerAction,
|
RegisterActor: registerAction,
|
||||||
RegisterActorDocumentation: registerActorDocumentation,
|
RegisterActorDocumentation: registerActorDocumentation,
|
||||||
RegisterAPIRoute: registerRoute,
|
RegisterAPIRoute: registerRoute,
|
||||||
|
|
Loading…
Reference in a new issue