diff options
author | Jesús Espino <jespinog@gmail.com> | 2018-08-20 18:22:08 +0200 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2018-08-20 09:22:08 -0700 |
commit | cea1796f0698956e4fab57a0015b292854bbbcf3 (patch) | |
tree | 6a1adcdf154d3307cba3d670b9a94ba4e39cc0f8 /plugin/api.go | |
parent | 56d92de3f20fa1d89c2d2c09b03e933a1325af8b (diff) | |
download | chat-cea1796f0698956e4fab57a0015b292854bbbcf3.tar.gz chat-cea1796f0698956e4fab57a0015b292854bbbcf3.tar.bz2 chat-cea1796f0698956e4fab57a0015b292854bbbcf3.zip |
Adding Permissions check and reactions function to plugins API (#9273)
* Adding reactions functions
* Adding permissions checking in the plugins api
Diffstat (limited to 'plugin/api.go')
-rw-r--r-- | plugin/api.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/plugin/api.go b/plugin/api.go index 256ac9f81..370c28268 100644 --- a/plugin/api.go +++ b/plugin/api.go @@ -143,6 +143,15 @@ type API interface { // CreatePost creates a post. CreatePost(post *model.Post) (*model.Post, *model.AppError) + // AddReaction add a reaction to a post. + AddReaction(reaction *model.Reaction) (*model.Reaction, *model.AppError) + + // RemoveReaction remove a reaction from a post. + RemoveReaction(reaction *model.Reaction) *model.AppError + + // GetReaction get the reactions of a post. + GetReactions(postId string) ([]*model.Reaction, *model.AppError) + // SendEphemeralPost creates an ephemeral post. SendEphemeralPost(userId string, post *model.Post) *model.Post @@ -184,6 +193,15 @@ type API interface { // broadcast determines to which users to send the event PublishWebSocketEvent(event string, payload map[string]interface{}, broadcast *model.WebsocketBroadcast) + // HasPermissionTo check if the user has the permission at system scope. + HasPermissionTo(userId string, permission *model.Permission) bool + + // HasPermissionToTeam check if the user has the permission at team scope. + HasPermissionToTeam(userId, teamId string, permission *model.Permission) bool + + // HasPermissionToChannel check if the user has the permission at channel scope. + HasPermissionToChannel(userId, channelId string, permission *model.Permission) bool + // LogDebug writes a log message to the Mattermost server log file. // Appropriate context such as the plugin name will already be added as fields so plugins // do not need to add that info. |