Return workflow owner access token.
15696
def get_owner_access_token(self):
        """"""
        from .database import Session
        db_session = Session.object_session(self)
        owner = db_session.query(User).filter_by(
            id_=self.owner_id).first()
        return owner.access_token
948588
def _get_workflow_by_uuid(workflow_uuid):
    
    from reana_db.models import Workflow
    workflow = Workflow.query.filter(Workflow.id_ ==
                                     workflow_uuid).first()
    if not workflow:
        raise ValueError(
            'REANA_WORKON is set to {0}, but '
            'that workflow does not exist. '
            'Please set your REANA_WORKON environment '
            'variable appropriately.'.
            format(workflow_uuid))
    return workflow
944444
def owner(self, data):
        """"""
        if data is not None:
            self._request.add_payload('owner', data)
        else:
            self.tcex.log.warn(u'Provided owner was invalid. ({})'.format(data))
182437
def get_authorization_url(self):
        """"""
        url = self._get_oauth_url('authenticate')
        query = {
            'client_id': self._client_id,
            'response_type': 'code',
            'redirect_uri': self.callback
        }
        query_str = self.urlencode(query)

        return url + '?' + query_str
398616
def get_owner(self, default=True):
        
        uid, gid = self.owner

        if not uid and default:
            uid = os.getuid()

        if not gid and default:
            gid = os.getgid()

        return uid, gid
235077
def get_user_owned_events(self, id, **data):
        
        
        return self.get("/users/{0}/owned_events/".format(id), data=data)
366965
public Token<DelegationTokenIdentifier> selectTokenFromFsOwner() throws IOException {
    return lookupToken(user.getCredentials(), service, tokenBinding.getKind());
  }
912194
def owner(self):
        """"""
        if self._writer is not None:
            return self.WRITER
        if self._readers:
            return self.READER
        return None
1363932
def get(self, sid):
        
        return WorkerContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, )
570154
def get_access_token(self):
        
        if self._token:
            now = time.time()
            if self.token_expires_at - now > 60:
                return self._token
        json = self.grant_token()
        self._token = json["access_token"]
        self.token_expires_at = int(time.time()) + json["expires_in"]
        return self._token
200973
def check_owner_permission(payload, allow_user_owner):
    """"""
    for entity_type in ['users', 'groups']:
        for perm_type in ['add', 'remove']:
            for perms in payload.get(entity_type, {}).get(perm_type, {}).values():
                if 'owner' in perms:
                    if entity_type == 'users' and allow_user_owner:
                        continue

                    if entity_type == 'groups':
                        raise exceptions.ParseError("Owner permission cannot be assigned to a group")

                    raise exceptions.PermissionDenied("Only owners can grant/revoke owner permission")
265391
def get(self, request, *args, **kwargs):
        """"""
        try:
            context = self.get_context_data(**kwargs)
        except exceptions.NotAvailable:
            exceptions.handle(request)
        self.set_workflow_step_errors(context)
        return self.render_to_response(context)
7708
def _get_token(self, oauth_request, token_type='access'):
        """"""
        token_field = oauth_request.get_parameter('oauth_token')
        token = self.data_store.lookup_token(token_type, token_field)
        if not token:
            raise OAuthError('Invalid %s token: %s' % (token_type, token_field))
        return token
814144
def get_user_token(self, scope, code=None):
        """"""

        user_token = self.__get_user_token(scope)

        if user_token:
            return user_token

        if self.__cache is not None:
            token = self.__cache.get(self.__user_token_cache_key())
            if token:
                return token

        if self.__redirect_uri is None or code is None:
            raise MxitAPIParameterException()

        self.__user_token = None

        payload = {
            'grant_type': 'authorization_code',
            'code': code,
            'redirect_uri': self.__redirect_uri
        }

        url = settings.AUTH_ENDPOINT + '/token'
        r = post(url, data=payload, auth=HTTPBasicAuth(self.__client_id, self.__client_secret), verify=self.__verify_cert)
        if r.status_code == 200:
            data = r.json()
            self.__set_user_token(scope, data[u'access_token'])
            if self.__cache is not None:
                self.__cache.set(self.__user_token_cache_key(scope), str(data[u'access_token']),
                                 data[u'expires_in'] - 300)

        user_token = self.__get_user_token(scope)

        if not user_token:
            raise MxitAPIException("Failed to retrieve user token for '%s' scope" % scope)

        return user_token
112657
def get_owned_by(cls, username, api=None):
        
        api = api if api else cls._API

        return super(Dataset, cls)._query(
            url=cls._URL['owned_by'].format(username=username),
            fields='_all',
            api=api
        )
1309364
def get_workflow(self):
        """"""
        extra_context = self.get_initial()
        entry_point = self.request.GET.get("step", None)
        workflow = self.workflow_class(self.request,
                                       context_seed=extra_context,
                                       entry_point=entry_point)
        return workflow
728056
def user(self):
        
        # Note, do any tasks really have an "owner_id", or are they all
        # "owner"?
        owner_id = getattr(self.task, 'owner_id', self.task.owner)
        return self.task.connection.cache.user_name(owner_id)