Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Smack+;openfire-是否可以检查当前用户是否为管理员?/如何检查当前用户的详细信息?_Java_Android_Admin_Openfire_Smack - Fatal编程技术网

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

Java Smack+;openfire-是否可以检查当前用户是否为管理员?/如何检查当前用户的详细信息?,java,android,admin,openfire,smack,Java,Android,Admin,Openfire,Smack,是否可以检查当前用户是否为管理员/如何检查当前用户详细信息?(Android中的Java smack+openfire) 当我尝试在openfire管理网页上创建用户时。有一个选项:是管理员吗?(授予管理员对Openfire的访问权限) 可以知道当前用户是否具有Openfire的管理员访问权限?(我的意思是在smack中,如何检查当前用户是否是OpenFire的管理员)试试这个 account = Connection.getAccountManager(); Collection<S

是否可以检查当前用户是否为管理员/如何检查当前用户详细信息?(Android中的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
account=Connection.getAccountManager();
集合属性=account.getAccountAttributes();
//检查属性中的值,应包含帐户类型

好的。。在“用户创建”页面上

是管理员吗?-->这意味着如果您想向您正在创建的用户授予管理员权限。管理员用户将拥有创建/删除用户、会话、组等的所有权限。 您可能不想向所有用户提供管理员权限

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

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

当前登录的用户将由其旁边的星号表示。(我想) 单击该用户,它将给出该用户的摘要。
Is Administrator?:属性将相应地为yes或no。

也许AdminManager中的方法会给您一些想法。 比如说,

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

公共列表getAdminAccounts()

您可以参考有关该类的信息。

有一个使用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();
}
/**
*返回包含服务器管理员JID的集合。收藏可能包括
*本地用户和远程服务器用户的JID。
*
*@返回一个包含服务器管理员JID的集合。
*/
公共集合getAdmins(){
返回AdminManager.getInstance().getAdminAccounts();
}

更多详细信息请参见。

您的意思是拥有root权限吗?我想知道当前用户是否具有Openfire的管理员访问权限/权限。谢谢,教授,我的问题不清楚。我已经编辑了我的问题。顺便说一句,您提供了一些有用的东西,谢谢Hanks frewper,但是可以在Android客户端中检查它吗?实际上,我想知道当前登录的用户(Android客户端)是否具有管理员权限。”集合属性=account.getAccountAttributes();'不表示用户是否为管理员。虽然此链接可以回答问题,但最好在此处包含答案的基本部分,并提供链接以供参考。如果链接页面发生更改,仅链接的答案可能无效。-这是我的疏忽,答案已经更新了。
/**
 * 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();
}