mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
feat(access): add guest chat ACL (#235)
This commit is contained in:
@@ -32,11 +32,14 @@ type BotMemberRoleAdapter struct {
|
||||
}
|
||||
|
||||
func (a *BotMemberRoleAdapter) GetMemberRole(ctx context.Context, botID, channelIdentityID string) (string, error) {
|
||||
member, err := a.BotService.GetMember(ctx, botID, channelIdentityID)
|
||||
bot, err := a.BotService.Get(ctx, botID)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return member.Role, nil
|
||||
if bot.OwnerUserID == channelIdentityID {
|
||||
return "owner", nil
|
||||
}
|
||||
return "", nil
|
||||
}
|
||||
|
||||
// Handler processes slash commands intercepted before they reach the LLM.
|
||||
@@ -187,7 +190,7 @@ func (h *Handler) Execute(ctx context.Context, botID, channelIdentityID, text st
|
||||
return fmt.Sprintf("Unknown action \"%s\" for /%s.\n\n%s", parsed.Action, parsed.Resource, group.Usage()), nil
|
||||
}
|
||||
|
||||
if sub.IsWrite && role != bots.MemberRoleOwner {
|
||||
if sub.IsWrite && role != "owner" {
|
||||
return "Permission denied: only the bot owner can execute this command.", nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user