-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannnot subscribe with access mode #737
Comments
Please attach the server-side and client-side logs. |
user A:
user B:
Again, to reproduce, just sub to group and ask for any access mode other than the default access mode. |
I cannot reproduce:
|
I suspect your previously subscribed to this topic. |
You are probably using your own gRPC client. |
I did some more tests and I'm not sure if i found another issue or it is the same. It seems to have something to do with gRPC plugins. To reproduce the problem:
package dummy_plg
import (
"context"
"net"
"github.com/tinode/chat/pbx"
"google.golang.org/grpc"
)
func main() {
lis, err := net.Listen("tcp", ":40051")
if err != nil {
panic(err)
}
s := grpc.NewServer()
pbx.RegisterPluginServer(s, handler{})
if err := s.Serve(lis); err != nil {
panic(err)
}
}
type handler struct {
pbx.UnimplementedPluginServer
}
func (h handler) FireHose(c context.Context, r *pbx.ClientReq) (*pbx.ServerResp, error) {
return &pbx.ServerResp{Status: pbx.RespCode_REPLACE, Clmsg: r.Msg}, nil
} tinode.conf
expected: everything works as if the plugin was not there server logs:
|
To fix the problem with func (h handler) FireHose(c context.Context, r *pbx.ClientReq) (*pbx.ServerResp, error) {
if r.Msg.Extra == nil {
r.Msg.Extra = &pbx.ClientExtra{}
}
r.Msg.Extra.OnBehalfOf = r.Sess.UserId
return &pbx.ServerResp{Status: pbx.RespCode_REPLACE, Clmsg: r.Msg}, nil
} |
I believe 1fc9699 should fix it. Please verify. |
Seems fixed, thanks. |
to reproduce:
Default access mode:
Auth: JRWPASD
Anon: N
{"sub":{"id":"122019","topic":"grpglXHsm2f9tc","set":{"sub":{"mode":"JRP"}},"get":{"data":{"limit":24},"what":"data sub desc"}}}
expected: user B joins the group successfully and has access mode JRP
got:
topic[grpglXHsm2f9tc] subscription failed subscription rejected due to permissions
asLvl
is 0 here when user B subs:chat/server/topic.go
Line 1363 in 65efc3e
The text was updated successfully, but these errors were encountered: