Package org.jivesoftware.openfire.pubsub

Examples of org.jivesoftware.openfire.pubsub.NodeAffiliate


        // 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;
    }
View Full Code Here


*/
public class OnlySubscribers extends PublisherModel {

    @Override
  public boolean canPublish(Node node, JID entity) {
        NodeAffiliate nodeAffiliate = node.getAffiliate(entity);
        // Deny access if user does not have any relation with the node or is an outcast
        if (nodeAffiliate == null ||
                nodeAffiliate.getAffiliation() == NodeAffiliate.Affiliation.outcast) {
            return false;
        }
        // Grant access if user is an owner of publisher
        if (nodeAffiliate.getAffiliation() == NodeAffiliate.Affiliation.publisher ||
                nodeAffiliate.getAffiliation() == NodeAffiliate.Affiliation.owner) {
            return true;
        }
        // Grant access if at least one subscription of this user was approved
        for (NodeSubscription subscription : nodeAffiliate.getSubscriptions()) {
            if (subscription.isActive()) {
                return true;
            }
        }
        return false;
View Full Code Here

  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
View Full Code Here

*/
public class OnlyPublishers extends PublisherModel {

    @Override
  public boolean canPublish(Node node, JID entity) {
        NodeAffiliate nodeAffiliate = node.getAffiliate(entity);
        return nodeAffiliate != null && (
                nodeAffiliate.getAffiliation() == NodeAffiliate.Affiliation.publisher ||
                        nodeAffiliate.getAffiliation() == NodeAffiliate.Affiliation.owner);
    }
View Full Code Here

TOP

Related Classes of org.jivesoftware.openfire.pubsub.NodeAffiliate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.