本文整理汇总了Java中org.jivesoftware.openfire.pubsub.Node.isAdmin方法的典型用法代码示例。如果您正苦于以下问题:Java Node.isAdmin方法的具体用法?Java Node.isAdmin怎么用?Java Node.isAdmin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.openfire.pubsub.Node
的用法示例。
在下文中一共展示了Node.isAdmin方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: canAccessItems
import org.jivesoftware.openfire.pubsub.Node; //导入方法依赖的package包/类
@Override
public boolean canAccessItems(Node node, JID owner, JID subscriber) {
// Let node owners and sysadmins always get node items
if (node.isAdmin(owner)) {
return true;
}
NodeAffiliate nodeAffiliate = node.getAffiliate(owner);
if (nodeAffiliate == null) {
// This is an unknown entity to the node so deny access
return false;
}
// Any subscription of this entity that was approved will give him access
// to retrieve the node items
for (NodeSubscription subscription : nodeAffiliate.getSubscriptions()) {
if (subscription.isActive()) {
return true;
}
}
// No approved subscription was found so deny access
return false;
}
示例2: canAccessItems
import org.jivesoftware.openfire.pubsub.Node; //导入方法依赖的package包/类
@Override
public boolean canAccessItems(Node node, JID owner, JID subscriber) {
// Let node owners and sysadmins always get node items
if (node.isAdmin(owner)) {
return true;
}
NodeAffiliate nodeAffiliate = node.getAffiliate(owner);
if (nodeAffiliate == null) {
// This is an unknown entity to the node so deny access
return false;
}
// Any subscription of this entity that was approved will give him access
// to retrieve the node items
for (NodeSubscription subscription : nodeAffiliate.getSubscriptions()) {
if (subscription.isActive()) {
return true;
}
}
// No approved subscription was found so deny access
return false;
}
示例3: canSubscribe
import org.jivesoftware.openfire.pubsub.Node; //导入方法依赖的package包/类
@Override
public boolean canSubscribe(Node node, JID owner, JID subscriber) {
// Let node owners and sysadmins always subcribe to the node
if (node.isAdmin(owner)) {
return true;
}
XMPPServer server = XMPPServer.getInstance();
for (JID nodeOwner : node.getOwners()) {
// Give access to the owner of the roster :)
if (nodeOwner.equals(owner)) {
return true;
}
// Check that the node owner is a local user
if (server.isLocal(nodeOwner)) {
try {
Roster roster = server.getRosterManager().getRoster(nodeOwner.getNode());
RosterItem item = roster.getRosterItem(owner);
// Check that the subscriber is subscribe to the node owner's presence
return item != null && (RosterItem.SUB_BOTH == item.getSubStatus() ||
RosterItem.SUB_FROM == item.getSubStatus());
}
catch (UserNotFoundException e) {
// Do nothing
}
}
else {
// Owner of the node is a remote user. This should never happen.
Log.warn("Node with access model Presence has a remote user as owner: " +
node.getNodeID());
}
}
return false;
}
示例4: canSubscribe
import org.jivesoftware.openfire.pubsub.Node; //导入方法依赖的package包/类
@Override
public boolean canSubscribe(Node node, JID owner, JID subscriber) {
// Let node owners and sysadmins always subcribe to the node
if (node.isAdmin(owner)) {
return true;
}
// User is in the whitelist if he has an affiliation and it is not of type outcast
NodeAffiliate nodeAffiliate = node.getAffiliate(owner);
return nodeAffiliate != null &&
nodeAffiliate.getAffiliation() != NodeAffiliate.Affiliation.outcast;
}
示例5: canSubscribe
import org.jivesoftware.openfire.pubsub.Node; //导入方法依赖的package包/类
@Override
public boolean canSubscribe(Node node, JID owner, JID subscriber) {
// Let node owners and sysadmins always subscribe to the node
if (node.isAdmin(owner)) {
return true;
}
for (JID nodeOwner : node.getOwners()) {
if (nodeOwner.equals(owner)) {
return true;
}
}
// Check that the subscriber is a local user
XMPPServer server = XMPPServer.getInstance();
if (server.isLocal(owner)) {
GroupManager gMgr = GroupManager.getInstance();
Collection<String> nodeGroups = node.getRosterGroupsAllowed();
for (String groupName : nodeGroups) {
try {
Group group = gMgr.getGroup(groupName);
// access allowed if the node group is visible to the subscriber
if (server.getRosterManager().isGroupVisible(group, owner)) {
return true;
}
} catch (GroupNotFoundException gnfe){
// ignore
}
}
}
else {
// Subscriber is a remote user. This should never happen.
Log.warn("Node with access model Roster has a remote user as subscriber: " +
node.getNodeID());
}
return false;
}
示例6: canSubscribe
import org.jivesoftware.openfire.pubsub.Node; //导入方法依赖的package包/类
@Override
public boolean canSubscribe(Node node, JID owner, JID subscriber) {
// Let node owners and sysadmins always subcribe to the node
if (node.isAdmin(owner)) {
return true;
}
// Get the only owner of the node
JID nodeOwner = node.getOwners().iterator().next();
// Give access to the owner of the roster :)
if (nodeOwner.toBareJID().equals(owner.toBareJID())) {
return true;
}
// Get the roster of the node owner
XMPPServer server = XMPPServer.getInstance();
// Check that the node owner is a local user
if (server.isLocal(nodeOwner)) {
try {
Roster roster = server.getRosterManager().getRoster(nodeOwner.getNode());
RosterItem item = roster.getRosterItem(owner);
// Check that the subscriber is subscribe to the node owner's presence
return item != null && (RosterItem.SUB_BOTH == item.getSubStatus() ||
RosterItem.SUB_FROM == item.getSubStatus());
}
catch (UserNotFoundException e) {
return false;
}
}
else {
// Owner of the node is a remote user. This should never happen.
Log.warn("Node with access model Presence has a remote user as owner: " +
node.getNodeID());
return false;
}
}
示例7: canSubscribe
import org.jivesoftware.openfire.pubsub.Node; //导入方法依赖的package包/类
@Override
public boolean canSubscribe(Node node, JID owner, JID subscriber) {
// Let node owners and sysadmins always subcribe to the node
if (node.isAdmin(owner)) {
return true;
}
// User is in the whitelist if he has an affiliation and it is not of type outcast
NodeAffiliate nodeAffiliate = node.getAffiliate(owner);
return nodeAffiliate != null &&
nodeAffiliate.getAffiliation() != NodeAffiliate.Affiliation.outcast;
}
示例8: canSubscribe
import org.jivesoftware.openfire.pubsub.Node; //导入方法依赖的package包/类
@Override
public boolean canSubscribe(Node node, JID owner, JID subscriber) {
// Let node owners and sysadmins always subcribe to the node
if (node.isAdmin(owner)) {
return true;
}
XMPPServer server = XMPPServer.getInstance();
for (JID nodeOwner : node.getOwners()) {
// Give access to the owner of the roster :)
if (nodeOwner.equals(owner.toBareJID())) {
return true;
}
// Check that the node owner is a local user
if (server.isLocal(nodeOwner)) {
try {
Roster roster = server.getRosterManager().getRoster(nodeOwner.getNode());
RosterItem item = roster.getRosterItem(owner);
// Check that the subscriber is subscribe to the node owner's presence
return item != null && (RosterItem.SUB_BOTH == item.getSubStatus() ||
RosterItem.SUB_FROM == item.getSubStatus());
}
catch (UserNotFoundException e) {
// Do nothing
}
}
else {
// Owner of the node is a remote user. This should never happen.
Log.warn("Node with access model Presence has a remote user as owner: " +
node.getNodeID());
}
}
return false;
}
示例9: canSubscribe
import org.jivesoftware.openfire.pubsub.Node; //导入方法依赖的package包/类
@Override
public boolean canSubscribe(Node node, JID owner, JID subscriber) {
// Let node owners and sysadmins always subscribe to the node
if (node.isAdmin(owner)) {
return true;
}
for (JID nodeOwner : node.getOwners()) {
if (nodeOwner.equals(owner)) {
return true;
}
}
// Check that the subscriber is a local user
XMPPServer server = XMPPServer.getInstance();
if (server.isLocal(owner)) {
GroupManager gMgr = GroupManager.getInstance();
Collection<String> nodeGroups = node.getRosterGroupsAllowed();
for (String groupName : nodeGroups) {
try {
Group group = gMgr.getGroup(groupName);
// access allowed if the node group is visible to the subscriber
if (server.getRosterManager().isGroupVisible(group, owner)) {
return true;
}
} catch (GroupNotFoundException gnfe){
// ignore
}
}
}
else {
// Subscriber is a remote user. This should never happen.
Log.warn("Node with access model Roster has a remote user as subscriber: " +
node.getNodeID());
}
return false;
}