Given a topic, checks whether the user can remove it from their subscription list.
509426
def can_unsubscribe_from_topic(self, topic, user):
        
        # A user can unsubscribe from topics if they are authenticated and if they have the
        # permission to read the related forum. Of course a user can unsubscribe only if they are
        #  already a subscriber of the considered topic.
        return (
            user.is_authenticated and
            topic.has_subscriber(user) and
            self._perform_basic_permission_check(topic.forum, user, 'can_read_forum')
        )
9183
private void _checkAndSubscribe(KafkaConsumer<?, ?> consumer, String topic) {
        synchronized (consumer) {
            Set<String> subscription = consumer.subscription();
            if (subscription == null || !subscription.contains(topic)) {
                consumer.subscribe(Arrays.asList(topic));
            }
        }
    }
8198
def remove_subscriber(session_id, observer_id):
    
    models.Observer.subscribers.through.objects.filter(
        subscriber_id=session_id, observer_id=observer_id
    ).delete()
279870
def can_delete_post(self, post, user):
        
        checker = self._get_checker(user)

        # A user can delete a post if...
        #     they are a superuser
        #     they are the original poster of the forum post
        #     they belong to the forum moderators
        is_author = self._is_post_author(post, user)
        can_delete = (
            user.is_superuser or
            (is_author and checker.has_perm('can_delete_own_posts', post.topic.forum)) or
            checker.has_perm('can_delete_posts', post.topic.forum)
        )
        return can_delete
624565
def unsubscribe(SubscriptionArn, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    if not SubscriptionArn.startswith('arn:aws:sns:'):
        # Grrr, AWS sent us an ARN that's NOT and ARN....
        # This can happen if, for instance, a subscription is left in PendingAcceptance or similar
        # Note that anything left in PendingConfirmation will be auto-deleted by AWS after 30 days
        # anyway, so this isn't as ugly a hack as it might seem at first...
        log.info('Invalid subscription ARN `%s` passed - likely a PendingConfirmaton or such.  '
                 'Skipping unsubscribe attempt as it would almost certainly fail...',
                 SubscriptionArn)
        return True
    subs = list_subscriptions(region=region, key=key, keyid=keyid, profile=profile)
    sub = [s for s in subs if s.get('SubscriptionArn') == SubscriptionArn]
    if not sub:
        log.error('Subscription ARN %s not found', SubscriptionArn)
        return False
    TopicArn = sub[0]['TopicArn']
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    try:
        conn.unsubscribe(SubscriptionArn=SubscriptionArn)
        log.info('Deleted subscription %s from SNS topic %s',
                 SubscriptionArn, TopicArn)
        return True
    except botocore.exceptions.ClientError as e:
        log.error('Failed to delete subscription %s: %s', SubscriptionArn, e)
        return False
594648
def clean(self):
        
        super().clean()
        if self.forum.is_category or self.forum.is_link:
            raise ValidationError(
                _('A topic can not be associated with a category or a link forum')
            )
58153
def perform_permissions_check(self, user, obj, perms):
        
        return self.request.forum_permission_handler.can_unsubscribe_from_topic(obj, user)
520649
protected void removeSubscription(SIBUuid12 topicSpace,
                                    String topic)
  {
    // Generate a key for the topicSpace/topic
    final String key = BusGroup.subscriptionKey(topicSpace, topic);

    iProxies.remove(key);
  }
692202
def remove_topic(self, topic_id):
        
        comment_start = 0
        while comment_start is not None:
            comments = self.list_comments(topic_id, comment_start)
            for comment in comments['results']:
                self.remove_comment(topic_id, comment['id'])
            comment_start = comments['next_start']
        return self.api.req(API_GROUP_REMOVE_TOPIC % topic_id, params={'ck': self.api.ck()})
1039634
def unregister_publisher(topic)
      code, message, val = @proxy.unregisterPublisher(@caller_id,
                                                      topic,
                                                      @slave_uri)
      if code == 1
        return val
      elsif code == 0
        puts message
        return true
      else
        raise message
      end
      return false
    end
961125
public void removeConsumerListForExpression(
    String topicExpression,
    boolean selector,
    boolean isWildcarded)
  {
    if (tc.isEntryEnabled()) 
      SibTr.entry(tc, 
                  "removeConsumerListForExpression", 
                  new Object[]{topicExpression, 
                               new Boolean(selector),
                               new Boolean(isWildcarded)});

    if(selector)
    {
      if(isWildcarded)
      {
        // Selector and wildcarded
        ArrayList consumerList = (ArrayList)_wildcardSelectorSubs.remove(topicExpression);
        if(consumerList == null)
        {
          // Couldn't find the consumerlist. This means we have an internal 
          // inconsistency in our tables, so throw an SIErrorException
          
          // Build the message for the Exception
          if (tc.isEntryEnabled()) 
            SibTr.exit(tc, "removeConsumerListForExpression", topicExpression);
      
          SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0005",
            new Object[] {
              "com.ibm.ws.sib.processor.matching.SubscriptionRegistrar",
              "1:265:1.5",
              topicExpression });  
          throw new SIErrorException(
            nls.getFormattedMessage(
              "INTERNAL_MESSAGING_ERROR_CWSIP0005",
              new Object[] {
                "com.ibm.ws.sib.processor.matching.SubscriptionRegistrar",
                "1:272:1.5",
                topicExpression },
              null));                       
        }                          
        // Test whether table is now empty
        if(_wildcardSelectorSubs.isEmpty())
          _areWildcardSelectorSubs = false;
      }
      else
      {
        // Selector but not wildcarded
        ArrayList consumerList = (ArrayList)_exactSelectorSubs.remove(topicExpression);
        if(consumerList == null)
        {
          // Couldn't find the consumerlist. This means we have an internal 
          // inconsistency in our tables, so throw an SIErrorException
        
          // Build the message for the Exception
          if (tc.isEntryEnabled()) 
            SibTr.exit(tc, "removeConsumerListForExpression", topicExpression);
      
          SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0005",
            new Object[] {
              "com.ibm.ws.sib.processor.matching.SubscriptionRegistrar",
              "1:296:1.5",
              topicExpression });  
          throw new SIErrorException(
            nls.getFormattedMessage(
              "INTERNAL_MESSAGING_ERROR_CWSIP0005",
              new Object[] {
                "com.ibm.ws.sib.processor.matching.SubscriptionRegistrar",
                "1:303:1.5",
                topicExpression },
              null));                       
        }                  
        // Test whether table is now empty
        if(_exactSelectorSubs.isEmpty())
          _areExactSelectorSubs = false;
      }
    }
    else
    {
      // No Selector expression
      if(isWildcarded)
      {
        // No selector and wildcarded
        ArrayList consumerList = (ArrayList)_wildcardNonSelectorSubs.remove(topicExpression);
        if(consumerList == null)
        {
          // Couldn't find the consumerlist. This means we have an internal 
          // inconsistency in our tables, so throw an SIErrorException
        
          // Build the message for the Exception
          if (tc.isEntryEnabled()) 
            SibTr.exit(tc, "removeConsumerListForExpression", topicExpression);
      
          SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0005",
            new Object[] {
              "com.ibm.ws.sib.processor.matching.SubscriptionRegistrar",
              "1:331:1.5",
              topicExpression });  
          throw new SIErrorException(
            nls.getFormattedMessage(
              "INTERNAL_MESSAGING_ERROR_CWSIP0005",
              new Object[] {
                "com.ibm.ws.sib.processor.matching.SubscriptionRegistrar",
                "1:338:1.5",
                topicExpression },
              null));                       
        }                       
        // Test whether table is now empty
        if(_wildcardNonSelectorSubs.isEmpty())
          _areWildcardNonSelectorSubs = false;        
      }
      else
      {
        // No selector and not wildcarded
        ArrayList consumerList = (ArrayList)_exactNonSelectorSubs.remove(topicExpression);
        if(consumerList == null)
        {
          // Couldn't find the consumerlist. This means we have an internal 
          // inconsistency in our tables, so throw an SIErrorException
        
          // Build the message for the Exception
          if (tc.isEntryEnabled()) 
            SibTr.exit(tc, "removeConsumerListForExpression", topicExpression);
      
          SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0005",
            new Object[] {
              "com.ibm.ws.sib.processor.matching.SubscriptionRegistrar",
              "1:362:1.5",
              topicExpression });  
          throw new SIErrorException(
            nls.getFormattedMessage(
              "INTERNAL_MESSAGING_ERROR_CWSIP0005",
              new Object[] {
                "com.ibm.ws.sib.processor.matching.SubscriptionRegistrar",
                "1:369:1.5",
                topicExpression },
              null));                       
        }                            
        // Test whether table is now empty
        if(_exactNonSelectorSubs.isEmpty())
          _areExactNonSelectorSubs = false;        
      }      
    }           
    if (tc.isEntryEnabled()) SibTr.exit(tc, "removeConsumerListForExpression");
  }
724300
@Override
	public void removeBySubscriptionStatus(int subscriptionStatus) {
		for (CommerceSubscriptionEntry commerceSubscriptionEntry : findBySubscriptionStatus(
				subscriptionStatus, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
			remove(commerceSubscriptionEntry);
		}
	}
1225276
def remove(self, username=None):
        """"""
        self._user_list = [user for user in self._user_list if user.name != username]
1354447
def can_update_topics_to_announces(self, forum, user):
        
        return (
            self._perform_basic_permission_check(forum, user, 'can_edit_posts') and
            self._perform_basic_permission_check(forum, user, 'can_post_announcements')
        )
1014908
def perform_permissions_check(self, user, obj, perms):
        
        return self.request.forum_permission_handler.can_lock_topics(obj, user)
208823
function removeAuthors( $removeList )
    {
        if ( count( $removeList ) > 0 )
            foreach ( $removeList as $id )
            {
                foreach ( $this->Authors as $authorKey => $author )
                {
                    if ( $author['id'] == $id )
                    {
                        array_splice( $this->Authors, $authorKey, 1 );
                        $this->AuthorCount --;
                    }
                }
            }
    }
434446
protected void sendUnsubscribe(String topic) {
    JsonObject msg = Json.createObject().set(TYPE, "unregister").set(TOPIC, topic);
    send(msg);
  }