本文整理汇总了Java中org.jivesoftware.openfire.pubsub.NodeAffiliate.getSubscriptions方法的典型用法代码示例。如果您正苦于以下问题:Java NodeAffiliate.getSubscriptions方法的具体用法?Java NodeAffiliate.getSubscriptions怎么用?Java NodeAffiliate.getSubscriptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.openfire.pubsub.NodeAffiliate
的用法示例。
在下文中一共展示了NodeAffiliate.getSubscriptions方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: canAccessItems
import org.jivesoftware.openfire.pubsub.NodeAffiliate; //导入方法依赖的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: canPublish
import org.jivesoftware.openfire.pubsub.NodeAffiliate; //导入方法依赖的package包/类
@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;
}
示例3: canAccessItems
import org.jivesoftware.openfire.pubsub.NodeAffiliate; //导入方法依赖的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;
}
示例4: canPublish
import org.jivesoftware.openfire.pubsub.NodeAffiliate; //导入方法依赖的package包/类
@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;
}