Adding Permissions check and reactions function to plugins API (#9273)

* Adding reactions functions

* Adding permissions checking in the plugins api
Этот коммит содержится в:
Jesús Espino
2018-08-20 18:22:08 +02:00
коммит произвёл Christopher Speller
родитель 56d92de3f2
Коммит cea1796f06
4 изменённых файлов: 325 добавлений и 0 удалений

Просмотреть файл

@@ -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.