This reverts commit ec88ab4ee9.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
4b88bfd5fb
Коммит
077221a940
@@ -83,6 +83,7 @@ func (a *App) SessionHasPermissionToChannel(c request.CTX, session model.Session
|
||||
}
|
||||
|
||||
ids, err := a.Srv().Store().Channel().GetAllChannelMembersForUser(session.UserId, true, true)
|
||||
|
||||
var channelRoles []string
|
||||
if err == nil {
|
||||
if roles, ok := ids[channelID]; ok {
|
||||
@@ -259,22 +260,17 @@ func (a *App) HasPermissionToChannel(c request.CTX, askingUserId string, channel
|
||||
return false
|
||||
}
|
||||
|
||||
// We call GetAllChannelMembersForUser instead of just getting
|
||||
// a single member from the DB, because it's cache backed
|
||||
// and this is a very frequent call.
|
||||
ids, err := a.Srv().Store().Channel().GetAllChannelMembersForUser(askingUserId, true, true)
|
||||
var channelRoles []string
|
||||
channelMember, err := a.GetChannelMember(c, channelID, askingUserId)
|
||||
if err == nil {
|
||||
if roles, ok := ids[channelID]; ok {
|
||||
channelRoles = strings.Fields(roles)
|
||||
if a.RolesGrantPermission(channelRoles, permission.Id) {
|
||||
return true
|
||||
}
|
||||
roles := channelMember.GetRoles()
|
||||
if a.RolesGrantPermission(roles, permission.Id) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
channel, appErr := a.GetChannel(c, channelID)
|
||||
if appErr == nil {
|
||||
var channel *model.Channel
|
||||
channel, err = a.GetChannel(c, channelID)
|
||||
if err == nil {
|
||||
return a.HasPermissionToTeam(c, askingUserId, channel.TeamId, permission)
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user