繁体   English   中英

Smack + openfire - 是否可以检查当前用户是否为管理员? /如何查看当前用户的详细信息?

[英]Smack + openfire - Is it possible to check the current user is administrator or not? / How to check current user details?

是否可以检查当前用户是否是管理员/如何检查当前用户的详细信息?(Java中的Java smack + openfire)?
当我尝试在openfire管理员网页上创建用户时。 有一个选择:
管理员? (授予管理员访问Openfire的权限)
可以知道当前用户是否具有Openfire的管理员权限? (我的意思是在smack中,如何检查当前用户是OpenFire的管理员)

试试这个,

 account = Connection.getAccountManager();
 Collection<String> attrs = account.getAccountAttributes();
 //inspect the values in attrs, should contain the type of account

好的..在用户创建页面上。

管理员? - >表示如果您想向您正在创建的用户授予管理员权限。 管理员用户将拥有创建/删除用户,会话,组等的所有权限。您可能不希望向所有用户提供管理员优先权。

如果您想知道当前用户或任何其他用户是否具有管理员权限,请转到

用户/组 - >用户 - >用户摘要(此处您将获得系统中的所有用户)

当前登录的用户将由旁边的星号表示。 (我认为)点击用户,然后它会给出用户的摘要。 是管理员?:属性是相应的

也许AdminManager中的方法会给你一些想法。 例如,

public boolean isUserAdmin(org.xmpp.packet.JID jid,
                           boolean allowAdminIfEmpty)

public List<org.xmpp.packet.JID> getAdminAccounts()

您可以参考有关该类的javadoc

有一个使用AdminManager来获取所有服务器管理员的示例:

/**
 * Returns a collection with the JIDs of the server's admins. The collection may include
 * JIDs of local users and users of remote servers.
 *
 * @return a collection with the JIDs of the server's admins.
 */
public Collection<JID> getAdmins() {
    return AdminManager.getInstance().getAdminAccounts();
}

更多细节可以在XMPPServer.java中找到。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM