啪啪啪+开火 - 是否可以检查当前用户是否是管理员?/ 如何查看当前用户详细信息



是否可以检查当前用户是否为管理员/如何查看当前用户详细信息?Java smack + openfire in Android)?
当我尝试在 openfire 管理网页上创建用户时。有一个选项:
是管理员吗? (授予对 Openfire 的管理员访问权限)
可以知道当前用户是否具有对 Openfire 的管理员访问权限?(我的意思是,如何检查当前用户是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中找到。

最新更新