Create a GitHub authorization for the given user in case they don't
           already have one.
427104
def _github_create_simple_authorization(cls):
        
        try:
            auth = None
            for a in cls._user.get_authorizations():
                if a.note == 'DevAssistant':
                    auth = a
            if not auth:
                auth = cls._user.create_authorization(
                    scopes=['repo', 'user', 'admin:public_key'],
                    note="DevAssistant")
                cls._github_store_authorization(cls._user, auth)
        except cls._gh_exceptions.GithubException as e:
            logger.warning('Creating authorization failed: {0}'.format(e))
205264
def gitlab_user_exists?(gitlab_url, private_token)
      with_gitlab(gitlab_url, private_token) do |g|
        g.user
      end

      true
    rescue Gitlab::Error::Unauthorized
      false
    end
745688
def make_owner(user):
    '''
    
    '''
    tutor_group, owner_group = _get_user_groups()
    user.is_staff = True
    user.is_superuser = False
    user.save()
    owner_group.user_set.add(user)
    owner_group.save()
    tutor_group.user_set.add(user)
    tutor_group.save()
939362
def create_with_user(self, user_params, **kwargs):
        
        affiliate = self.create(**kwargs)
        self.api.affiliate_users.create(affiliate_id=affiliate.id, **user_params)
        return affiliate
269091
def create(self, user: str, *,
               pwd: str, sgrp: str, comment: str=None) -> None:
        """"""
        data = {
            'action': 'add',
            'user': user,
            'pwd': pwd,
            'grp': 'users',
            'sgrp': sgrp
        }

        if comment:
            data['comment'] = comment

        self._request('post', URL, data=data)
871672
def authorize(auth = {})
      @authentication ||= TaskMapper::Authenticator.new(auth)
      auth = @authentication
      if (auth.username.nil? || auth.url.nil? || auth.password.nil?)
        raise "Please provide username, password and url"
      end
      url = auth.url.gsub(/\/$/,'')
      unless url.split('/').last == 'xmlrpc.cgi'
        auth.url = url+'/xmlrpc.cgi'
      end
      @bugzilla = Rubyzilla::Bugzilla.new(auth.url)
      begin
        @bugzilla.login(auth.username,auth.password)
      rescue
        warn 'Authentication was invalid'
      end
    end
1026034
def create(cls, user_id, github_id=None, name=None, **kwargs):
        """"""
        with db.session.begin_nested():
            obj = cls(user_id=user_id, github_id=github_id, name=name,
                      **kwargs)
            db.session.add(obj)
        return obj
889291
def create(self, request, *args, **kwargs):
        """"""
        if not request.user.is_authenticated:
            raise exceptions.NotFound

        return super().create(request, *args, **kwargs)
932898
def auth_as(self, user):
        """"""
        old_user = self._user
        self.auth(user)
        try:
            yield
        finally:
            self.auth(old_user)
903448
def create_user(username, rsa_pub_key, rsa_pub_key_name)
      key_name = "#{username}@#{rsa_pub_key_name}"
      key_path = @configuration.user_key_path(key_name)

      if users_public_keys().include?(key_path)
        raise ::Gitolite::Duplicate, "Public key (#{rsa_pub_key_name}) already exists for user (#{username}) on gitolite server"
      end

      add_commit_file(key_path,rsa_pub_key, "Added public key (#{rsa_pub_key_name}) for user (#{username}) ")

      key_path
    end
360803
def configure_user(gh_token, repo):
    
    user = user_from_token(gh_token)
    repo.git.config('user.email', user.email or 'aspysdk2@microsoft.com')
    repo.git.config('user.name', user.name or 'SwaggerToSDK Automation')
889752
def create_user(cls, username, password, name, email):
        """"""
        config = Config()
        payload = {"username": username,
                   "email": email,
                   "name": name,
                   "password": password, }
        user_creation_resp = requests.post("https://users.{}/users/".format(config.host),
                                           json=payload)
        if user_creation_resp.status_code != 201:
            raise errors.ResourceError("couldnt create user")
125545
function GitHub(ready, user, pass, useSsh) {

  var opts = {
    version: '3.0.0',
    timeout: 30000
  };

  var proxy = bag.proxy();
  if (proxy) {
    proxy = url.parse(proxy);
    opts.proxy = {
      host: proxy.hostname,
      port: proxy.port
    };
  }

  this.gh = new github(opts);
  this.useSsh = useSsh;

  var self = this;
  if (user && pass) {
    // if credentials are provided, use those to authenticate
    self.gh.authenticate({
      type: 'basic',
      username: user,
      password: pass
    });
    // the other branches (oauth and no authentication only call the ready()
    // callback after another callback has resolved, which guarantees that this
    // (constructor) function has returned before the ready callback has been
    // called. This, in turn, ensures that the code calling this constructor has received a constructed object. To ensure this also for the basic auth case, we need to make this asynchronous as well.
    process.nextTick(ready);
  } else {
    var gitHubAuth = new GithubAuth();
    gitHubAuth
      .readAuthToken()
      .then(function success(token) {
        self.gh.authenticate({
          type : 'oauth',
          token : token
        });
        ready();
      }, function error() {
        // no auth token, user did not execute repoman --signin
        // continue without authentication
        ready();
    });
  }
}
1136335
def _create_user(ctx):
    """"""

    username, passhash = _get_credentials(ctx.obj['username'],
                                          ctx.obj['password'],
                                          ctx.obj['db'])

    if ctx.obj['db'].objectmodels['user'].count({'name': username}) > 0:
        raise KeyError()

    new_user = ctx.obj['db'].objectmodels['user']({
        'uuid': str(uuid4()),
        'created': std_now()
    })

    new_user.name = username
    new_user.passhash = passhash

    return new_user
335546
def create_api_handler(self):
        
        try:
            self.github = github3.login(username=config.data['gh_user'],
                                    password=config.data['gh_password'])
        except KeyError as e:
            raise config.NotConfigured(e)
        logger.info("ratelimit remaining: {}".format(self.github.ratelimit_remaining))
        if hasattr(self.github, 'set_user_agent'):
            self.github.set_user_agent('{}: {}'.format(self.org_name, self.org_homepage))
        try:
            self.org = self.github.organization(self.org_name)
        except github3.GitHubError:
            logger.error("Possibly the github ratelimit has been exceeded")
            logger.info("ratelimit: " + str(self.github.ratelimit_remaining))
688317
def _do_authorize(self):
        
        if self.auth_data is None:
            raise ApiwatcherClientException("You must provide authorization data.")

        r = requests.post(
            "{0}/api/token".format(self.base_url), json=self.auth_data,
            verify=self.verify_certificate, timeout=self.timeout
        )

        if r.status_code == 401:
            raise ApiwatcherClientException("Wrong credentials supplied: {0}".format(
                r.json()["message"]
            ))
        elif r.status_code != 201:
            try:
                reason = r.json()["message"]
            except:
                reason = r.text
            raise ApiwatcherClientException(
                "Authorization failed. Reason {0} {1}".format(
                    r.status_code, reason)
                )
        else:
            data = r.json()["data"]
            self.token = data["access_token"]

            if "refresh_token" in data:
                self.auth_data = {
                    "grant_type": "refresh_token",
                    "refresh_token": data["refresh_token"],
                    "client_id": self.auth_data["client_id"]
                }
962730
def create_user(self, **kwargs):
        """"""
        roles = kwargs.pop('roles', [])
        user = self.user_model(**self._prepare_create_user_args(**kwargs))
        user = self.put(user)
        for role in roles:
            self.add_role_to_user(user, role)
        self.put(user)
        return user