当前位置: 首页>>代码示例>>Java>>正文


Java Node.isAdmin方法代码示例

本文整理汇总了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;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:22,代码来源:AuthorizeAccess.java

示例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;
   }
 
开发者ID:coodeer,项目名称:g3server,代码行数:22,代码来源:AuthorizeAccess.java

示例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;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:34,代码来源:PresenceAccess.java

示例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;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:12,代码来源:WhitelistAccess.java

示例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;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:36,代码来源:RosterAccess.java

示例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;
       }
   }
 
开发者ID:coodeer,项目名称:g3server,代码行数:35,代码来源:PresenceAccess.java

示例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;
   }
 
开发者ID:coodeer,项目名称:g3server,代码行数:12,代码来源:WhitelistAccess.java

示例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;
   }
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:34,代码来源:PresenceAccess.java

示例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;
   }
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:36,代码来源:RosterAccess.java


注:本文中的org.jivesoftware.openfire.pubsub.Node.isAdmin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。