MG-327 - Allow superadmin to access channel messages (#377)

* refactor: allow superadmin to read channel messages

Signed-off-by: Felix Gateru <felix.gateru@gmail.com>

* dep: update SMQ version

Signed-off-by: Felix Gateru <felix.gateru@gmail.com>

---------

Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
This commit is contained in:
Felix Gateru
2026-01-15 19:53:41 +03:00
committed by GitHub
parent 91bdb274b2
commit 5a769e1981
3 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ require (
github.com/0x6flab/namegenerator v1.4.0
github.com/absmach/callhome v0.18.2
github.com/absmach/certs v0.18.3
github.com/absmach/supermq v0.18.4
github.com/absmach/supermq v0.18.5-0.20260115163411-551d44d58e72
github.com/authzed/authzed-go v1.7.0
github.com/authzed/grpcutil v0.0.0-20250221190651-1985b19b35b8
github.com/caarlos0/env/v11 v11.3.1
+2
View File
@@ -32,6 +32,8 @@ github.com/absmach/senml v1.0.8 h1:+opem/r4g6c6eA/JLyCIuksyEhj7eBdysY3pEmy1mqo=
github.com/absmach/senml v1.0.8/go.mod h1:DRhzHLgvQoIUHroBgpFrSWso+bJZO9E96RlHAHy+VRI=
github.com/absmach/supermq v0.18.4 h1:7GG0O6pgadR2xmpm9rhXDXJFdU2xnLUwqE6unN4pEEY=
github.com/absmach/supermq v0.18.4/go.mod h1:RdAohsDpSIn78d+F68RYSOKI3Dc0hwqsQixyqzIRsuI=
github.com/absmach/supermq v0.18.5-0.20260115163411-551d44d58e72 h1:T8f9b/6pOTg+1z1v66cH/+vVwkYG6GjDlD6x0VgbDiE=
github.com/absmach/supermq v0.18.5-0.20260115163411-551d44d58e72/go.mod h1:Kxd67CX6ggPNiToD9dyEjfideyoiZMMQP7f9rzAHSgo=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
+4 -1
View File
@@ -227,8 +227,11 @@ func authenticate(ctx context.Context, req listMessagesReq, authn smqauthn.Authe
if err != nil {
return "", "", err
}
if session.Role == smqauthn.AdminRole {
return session.UserID, policies.UserType, nil
}
return session.UserID, policies.UserType, nil
return policies.EncodeDomainUserID(req.domain, session.UserID), policies.UserType, nil
case req.key != "":
res, err := clients.Authenticate(ctx, &grpcClientsV1.AuthnReq{
Token: smqauthn.AuthPack(smqauthn.DomainAuth, req.chanID, req.key),