MM-53098 Fix for checking bot and user permissions on shared endpoints (#23751)
* temp commit * update test to allow bot creation * add bot check to updateUser and deleteUser * add more unit tests * lint fixes * lint fix * update based on doc * add more unit tests * lint fixes * fix unit tests * fix unit tests --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
2abcdfe76a
Коммит
30140c0a27
@@ -258,14 +258,16 @@ func (a *App) SessionHasPermissionToUserOrBot(session model.Session, userID stri
|
||||
if session.IsUnrestricted() {
|
||||
return true
|
||||
}
|
||||
if a.SessionHasPermissionToUser(session, userID) {
|
||||
|
||||
err := a.SessionHasPermissionToManageBot(session, userID)
|
||||
if err == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
if err := a.SessionHasPermissionToManageBot(session, userID); err == nil {
|
||||
return true
|
||||
if err.Id == "store.sql_bot.get.missing.app_error" && err.Unwrap() != nil {
|
||||
if a.SessionHasPermissionToUser(session, userID) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user