Uses a SteemConnect accses token
        to vote.
543338
def vote(self, voter, author, permlink, voteweight):
        ''' 
        '''
        vote = Vote(voter, author, permlink, voteweight)
        result = self.steemconnect().broadcast(
            [vote.to_operation_structure()])
        return result
484234
function (params) {
  const oThis = this
  ;

  oThis.brandedTokenUuid = params.uuid;
  oThis.amountToStakeInWeis = params.amount_to_stake_in_weis;
  oThis.reserveAddr = params.reserve_address;
  oThis.reservePassphrase = params.reserve_passphrase;
  oThis.erc20Address = params.erc20_address;
}
899556
public function vote(TokenInterface $token, $object, array $attributes)
    {
        if (!$object instanceof User && !$object instanceof UserCollection) return VoterInterface::ACCESS_ABSTAIN;
        $users = $object instanceof UserCollection ? $object->getUsers(): array($object);
        $action = strtolower($attributes[0]);

        switch ($action) {
            case self::VIEW:   return $this->checkView($users);
            case self::CREATE: return $this->checkCreation($users);
            case self::EDIT:   return $this->checkEdit($token, $users);
            case self::DELETE: return $this->checkDelete($token, $users);
        }

        return VoterInterface::ACCESS_ABSTAIN;
    }
1235755
def can_vote_in_poll(self, poll, user):
        
        # First we have to check if the poll is curently open
        if poll.duration:
            poll_dtend = poll.created + dt.timedelta(days=poll.duration)
            if poll_dtend < now():
                return False

        # Is this user allowed to vote in polls in the current forum?
        can_vote = (
            self._perform_basic_permission_check(poll.topic.forum, user, 'can_vote_in_polls') and
            not poll.topic.is_locked
        )

        # Retrieve the user votes for the considered poll
        user_votes = TopicPollVote.objects.filter(poll_option__poll=poll)
        if user.is_anonymous:
            forum_key = get_anonymous_user_forum_key(user)
            if forum_key:
                user_votes = user_votes.filter(anonymous_key=forum_key)
            else:
                # If the forum key of the anonymous user cannot be retrieved, the user should not be
                # allowed to vote in the considered poll.
                user_votes = user_votes.none()
                can_vote = False
        else:
            user_votes = user_votes.filter(voter=user)

        # If the user has already voted, they can vote again if the vote changes are allowed
        if user_votes.exists() and can_vote:
            can_vote = poll.user_changes

        return can_vote
1204214
private static EsToken getEsAuthToken(ClusterName clusterName, User user) {
        return user.getEsToken(clusterName.getName());
    }
366965
public Token<DelegationTokenIdentifier> selectTokenFromFsOwner() throws IOException {
    return lookupToken(user.getCredentials(), service, tokenBinding.getKind());
  }
652586
function touch(token, cb) {
  var date = stampify(conf.session_maxage);
  db.getClient(function(err, client, done) {
    client.query("UPDATE tokens SET expires_at = $1 WHERE token = $2", [date, token], function() {
      cb.apply(null, arguments);
      done();
    });
  });
}
444570
def elevate_token(th):
    '''
    
    '''
    # Get list of privileges this token contains
    privileges = win32security.GetTokenInformation(
        th, win32security.TokenPrivileges)

    # Create a set of all privileges to be enabled
    enable_privs = set()
    for luid, flags in privileges:
        enable_privs.add((luid, win32con.SE_PRIVILEGE_ENABLED))

    # Enable the privileges
    if win32security.AdjustTokenPrivileges(th, 0, enable_privs) == 0:
        raise WindowsError(win32api.FormatMessage(win32api.GetLastError()))
593972
private void visit_OP_GET_DELEGATION_TOKEN() throws IOException {
    visitTxId();
    
    v.visitByte(EditsElement.T_VERSION);
    v.visitStringText(EditsElement.T_OWNER);
    v.visitStringText(EditsElement.T_RENEWER);
    v.visitStringText(EditsElement.T_REAL_USER);
    v.visitVLong(EditsElement.T_ISSUE_DATE);
    v.visitVLong(EditsElement.T_MAX_DATE);
    v.visitVInt(EditsElement.T_SEQUENCE_NUMBER);
    v.visitVInt(EditsElement.T_MASTER_KEY_ID);
    if (LayoutVersion.supports(Feature.EDITLOG_OP_OPTIMIZATION, editsVersion)) {
      v.visitLong(EditsElement.T_EXPIRY_TIME);
    } else {
      v.visitStringUTF8(EditsElement.T_EXPIRY_TIME);
    }
  }
812903
public int vote(Authentication authentication, Object object, Collection<ConfigAttribute> configAttributes) {
    int result = ACCESS_ABSTAIN;

    if (authentication.getDetails() instanceof OAuthAuthenticationDetails) {
      OAuthAuthenticationDetails details = (OAuthAuthenticationDetails) authentication.getDetails();
      for (Object configAttribute : configAttributes) {
        ConfigAttribute attribute = (ConfigAttribute) configAttribute;

        if (ConsumerSecurityConfig.PERMIT_ALL_ATTRIBUTE.equals(attribute)) {
          return ACCESS_GRANTED;
        }
        else if (ConsumerSecurityConfig.DENY_ALL_ATTRIBUTE.equals(attribute)) {
          return ACCESS_DENIED;
        }
        else if (supports(attribute)) {
          ConsumerSecurityConfig config = (ConsumerSecurityConfig) attribute;
          if ((config.getSecurityType() == ConsumerSecurityConfig.ConsumerSecurityType.CONSUMER_KEY)
            && (config.getAttribute().equals(details.getConsumerDetails().getConsumerKey()))) {
            return ACCESS_GRANTED;
          }
          else if (config.getSecurityType() == ConsumerSecurityConfig.ConsumerSecurityType.CONSUMER_ROLE) {
            List<GrantedAuthority> authorities = details.getConsumerDetails().getAuthorities();
            if (authorities != null) {
              for (GrantedAuthority authority : authorities) {
                if (authority.getAuthority().equals(config.getAttribute())) {
                  return ACCESS_GRANTED;
                }
              }
            }
          }
        }
      }
    }

    return result;
  }
504489
private static Token<EsTokenIdentifier> getAuthToken(ClusterName clusterName, User user) {
        EsToken esToken = getEsAuthToken(clusterName, user);
        if (esToken == null) {
            return null;
        } else {
            return EsTokenIdentifier.createTokenFrom(esToken);
        }
    }
877012
function transact(transaction, api, secret, options, converter, callback) {
  if (options.submit === false) {
    prepareAndOptionallySign.apply(this, arguments);
  } else {
    prepareAndSignAndSubmit.apply(this, arguments);
  }
}
698414
def vote(session, nick, pid, response):
    """"""
    if not response:
        return "You have to vote something!"
    if response == "n" or response == "nay":
        response = "no"
    elif response == "y" or response == "aye":
        response = "yes"
    poll = get_open_poll(session, pid)
    if poll is None:
        return "That poll doesn't exist or isn't active. Use !poll list to see valid polls"
    old_vote = get_response(session, pid, nick)
    if old_vote is None:
        session.add(Poll_responses(pid=pid, response=response, voter=nick))
        return "%s voted %s." % (nick, response)
    else:
        if response == old_vote.response:
            return "You've already voted %s." % response
        else:
            msg = "%s changed their vote from %s to %s." % (nick, old_vote.response, response)
            old_vote.response = response
            return msg
1237621
def start(self):
        """"""
        self.storage.update({
            'term': self.storage.term + 1,
            'voted_for': self.id
        })

        self.vote_count = 1
        self.request_vote()
        self.election_timer.start()
891583
public function vote(TokenInterface $token, $object, array $attributes)
    {
        if (!$object instanceof Group && !$object instanceof GroupCollection) return VoterInterface::ACCESS_ABSTAIN;
        $groups = $object instanceof GroupCollection ? $object->getGroups(): array($object);
        $action = strtolower($attributes[0]);

        switch ($action) {
            case self::CREATE: return $this->checkCreation($token);
            case self::EDIT:   return $this->checkEdit($token, $groups);
            case self::DELETE: return $this->checkDelete($token, $groups);
            case self::VIEW:   return $this->checkView($token, $groups);
        }

        return VoterInterface::ACCESS_ABSTAIN;
    }
904220
def can_vote(self, request):
        
        modelbase_obj = self.modelbase_obj

        # can't vote if liking is closed
        if modelbase_obj.likes_closed:
            return False, 'closed'
        
        # can't vote if liking is disabled
        if not modelbase_obj.likes_enabled:
            return False, 'disabled'

        # anonymous users can't vote if anonymous likes are disabled
        if not request.user.is_authenticated() and not modelbase_obj.anonymous_likes:
            return False, 'auth_required'
          
        # return false if existing votes are found
        if Vote.objects.filter(object_id=modelbase_obj.id, token=request.secretballot_token).count() == 0:
            return True, 'can_vote'
        else:
            return False, 'voted'
716375
@Override
  public PollResult startPoll(PollController conn)
  {
    if (! _lifecycle.isActive()) {
      log.warning(this + " select disabled");

      return PollResult.CLOSED;
    }

    SocketBar socket = conn.getSocket();

    if (socket == null) {
      log.warning(this + " socket empty for " + conn);

      return PollResult.CLOSED;
    }

    SelectableChannel selChannel = socket.selectableChannel();

    if (selChannel == null) {
      log.warning(this + " no channel for " + socket);

      return PollResult.CLOSED;
    }

    _connectionCount.incrementAndGet();

    _activeCount.incrementAndGet();

    _registerQueue.offer(conn);
    
    return PollResult.START;
  }