aSmack muc.getMembers()禁止(403)的Openfire [英] aSmack muc.getMembers() Forbidden (403) OPENFIRE

查看:572
本文介绍了aSmack muc.getMembers()禁止(403)的Openfire的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想允许任何聊天室的成员得到所有成员的名单。目前,只有谁是版主的用户可以这样做。我似乎无法找到我需要设置/更改用户权限,允许这一点。

I would like to allow any chat room member to get a list of all of the members. Currently, only users who are moderators may do so. I cannot seem to find where I need to set / change the user privileges to allow for this.

如果身份登录主持人下面code ++工程:

If logged in as a moderator the following code works:

 try {
                Collection<Affiliate> members = muc.getMembers();
                System.out.println(members.size());
            } catch(XMPPException e) {
                e.printStackTrace();
            }

如果登录作为一个普通成员,上面的code抛出一个紫禁城403错误。

If logged in as a normal member, the above code throws a Forbidden 403 error.

 06-25 19:53:51.198: W/System.err(12943): forbidden(403)
 06-25 19:53:51.208: W/System.err(12943):   at org.jivesoftware.smackx.muc.MultiUserChat.getAffiliatesByAdmin(MultiUserChat.java:1743)
 06-25 19:53:51.208: W/System.err(12943):   at org.jivesoftware.smackx.muc.MultiUserChat.getMembers(MultiUserChat.java:1657)

任何意见将是多少AP preciated。

Any advice would be much appreciated.

推荐答案

两点建议:

1)确保与所用实例化MulitUserChat实例(MUC会话相关联的用户)有足够的空间权限,才能使成员名单(我想,但我不知道,用户需要为房间管理员权限)

1) Make sure the user associated with the session used to instantiate the MulitUserChat instance (muc) has sufficient room privileges to get the members list (I think, but am not sure, that the user needs admin privileges for the room)

2)如果1被充分处理,确保您呼叫SmackAndroid.init(上下文的背景下)

2) If 1 is sufficiently handled make sure you are calling SmackAndroid.init(Context context)

希望这有助于!

- 关于你的最后一个注释 -

-- with regard to your last comment --

我失去了原来的问题的视线道歉。你是正确的,这两个函数只能由管理员用户调用。有没有办法(据我所知),以有一个成员获得管理员权限没有管理员用户的同意。更多的考虑之后,我断定这是一个贫穷的解决方案,反正为授予管理权限给所有用户危及您的聊天室的安全性。幸运的是,有一个更好的解决方案(这是一个有点更复杂):

I apologize from losing sight of the original question. You are correct, both functions can only be called by an admin user. There is no way (that I am aware of) to have a member gain admin privileges without the consent of an admin user. After a bit more consideration, I concluded that this is a poor solution anyway as granting admin privileges to all users compromises the security of your chat room. Fortunately, there is a better solution(it is a bit more involved):

您可以创建一个插件(的http://www.igniterealtime.org/builds/openfire/docs/latest/documentation/plugin-dev-guide.html)使用该botz库( http://community.igniterealtime.org/docs/DOC -1130#注释-5601 )。一旦创建睦室授予BOT管理员权限的房间。当用户需要拉下成员列表,用户应该查询发送给机器人,机器人。应该查询房间和继电器的结果给用户这样的设计$ p $从很有趣pserves你的房间的安全,一边,botz可以超越这个目的有用的 - 我希望这有助于

You can create a plugin (http://www.igniterealtime.org/builds/openfire/docs/latest/documentation/plugin-dev-guide.html) that uses the botz library (http://community.igniterealtime.org/docs/DOC-1130#comment-5601). Upon creation of a muc room grant the bot admin privileges to the room. When a user needs to pull down the members list, the user should send the query to the bot, the bot should query the room and relay the results to the user. This design preserves the security of your room and, aside from being fun, botz can be useful beyond this purpose. -- I hope this helps

这篇关于aSmack muc.getMembers()禁止(403)的Openfire的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆