hunk.code_window: 	}
   	return false
   }
   func (a *App) SessionHasPermissionToPost(session model.Session, postId string, permission *model.Permission) bool {
   	post, err := a.GetSinglePost(postId)
   	if err != nil {
   		return false
   	}
   	if post.UserId == session.UserId {
   		return true
   	}
   	return a.SessionHasPermissionToChannel(session, post.ChannelId, permission)
   }
   func (a *App) HasPermissionTo(askingUserId string, permission *model.Permission) bool {
   	user, err := a.GetUser(askingUserId)
   	if err != nil {
   		return false
   	}
  
hunk.labels: keep keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
hunk.file_path: app/authorization.go
hunk.type: replace
file: // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
  // See License.txt for license information.
  
  package model
  
  import (
  	"strings"
  	"testing"
  )
  
  func TestSystemJson(t *testing.T) {
  	system := System{Name: "test", Value: NewId()}
  	json := system.ToJson()
  	result := SystemFromJson(strings.NewReader(json))
  
  	if result.Name != "test" {
  		t.Fatal("Ids do not match")
  	}
  }
  