// Fetches the quota allocated for a user.
// 
// Parameters:
//  - OwnerRole
183450
func (p *ReadOnlySchedulerClient) GetQuota(ctx context.Context, ownerRole string) (r *Response, err error) {
  var _args66 ReadOnlySchedulerGetQuotaArgs
  _args66.OwnerRole = ownerRole
  var _result67 ReadOnlySchedulerGetQuotaResult
  if err = p.Client_().Call(ctx, "getQuota", &_args66, &_result67); err != nil {
    return
  }
  return _result67.GetSuccess(), nil
}
924740
func (cg *Consumergroup) PartitionOwner(topic string, partition int32) (*ConsumergroupInstance, error) {
	node := fmt.Sprintf("%s/consumers/%s/owners/%s/%d", cg.kz.conf.Chroot, cg.Name, topic, partition)
	val, _, err := cg.kz.conn.Get(node)

	// If the node does not exists, nobody has claimed it.
	switch err {
	case nil:
		return &ConsumergroupInstance{cg: cg, ID: string(val)}, nil
	case zk.ErrNoNode:
		return nil, nil
	default:
		return nil, err
	}
}
841729
func (a *Auth) UsersWithRole(role string) (users []User) {
	for _, user := range a.robot.Users.All() {
		if a.HasRole(user.ID, role) {
			users = append(users, user)
		}
	}
	return
}
160555
func (q Rate) Quota() (int, time.Duration) {
	return q.count, q.period * time.Duration(q.count)
}
72038
func (m *MetaClient) UserRoles(ctx context.Context) (map[string]Roles, error) {
	res, err := m.Roles(ctx, nil)
	if err != nil {
		return nil, err
	}

	userRoles := make(map[string]Roles)
	for _, role := range res.Roles {
		for _, u := range role.Users {
			ur, ok := userRoles[u]
			if !ok {
				ur = Roles{}
			}
			ur.Roles = append(ur.Roles, role)
			userRoles[u] = ur
		}
	}
	return userRoles, nil
}
702022
func (a *AuthServer) GetRole(name string) (services.Role, error) {
	return a.GetCache().GetRole(name)
}
1021709
func (o *Organization) GetOwnedPrivateRepos() int {
	if o == nil || o.OwnedPrivateRepos == nil {
		return 0
	}
	return *o.OwnedPrivateRepos
}
720165
func (client *Client) GrantAccountPrivilege(args *GrantAccountPrivilegeArgs) (resp *GrantAccountPrivilegeResponse, err error) {
	response := GrantAccountPrivilegeResponse{}
	err = client.Invoke("GrantAccountPrivilege", args, &response)

	if err != nil {
		return nil, err
	}
	return &response, nil
}
1090634
func (a *AuthWithRoles) GetRole(name string) (services.Role, error) {
	if err := a.action(defaults.Namespace, services.KindRole, services.VerbRead); err != nil {
		// allow user to read roles assigned to them
		log.Infof("%v %v %v", a.user, a.user.GetRoles(), name)
		if !utils.SliceContainsStr(a.user.GetRoles(), name) {
			return nil, trace.Wrap(err)
		}
	}
	return a.authServer.GetRole(name)
}
135601
func AuthUserUserPermissionByUserIDPermissionID(db XODB, userID float64, permissionID float64) (*AuthUserUserPermission, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`id, user_id, permission_id ` +
		`FROM django.auth_user_user_permissions ` +
		`WHERE user_id = :1 AND permission_id = :2`

	// run query
	XOLog(sqlstr, userID, permissionID)
	auup := AuthUserUserPermission{
		_exists: true,
	}

	err = db.QueryRow(sqlstr, userID, permissionID).Scan(&auup.ID, &auup.UserID, &auup.PermissionID)
	if err != nil {
		return nil, err
	}

	return &auup, nil
}
206129
func (b *lowBuilder) searchOwner() (owner *serverconfig.Owner, err error) {
	if b.high.Identity == "" {
		return nil, errNoOwner
	}
	if b.high.IdentitySecretRing == "" {
		return nil, errNoOwner
	}
	return &serverconfig.Owner{
		Identity:    b.high.Identity,
		SecringFile: b.high.IdentitySecretRing,
	}, nil
}
280831
func (p *AuroraAdminClient) SetQuota(ctx context.Context, ownerRole string, quota *ResourceAggregate) (r *Response, err error) {
  var _args316 AuroraAdminSetQuotaArgs
  _args316.OwnerRole = ownerRole
  _args316.Quota = quota
  var _result317 AuroraAdminSetQuotaResult
  if err = p.Client_().Call(ctx, "setQuota", &_args316, &_result317); err != nil {
    return
  }
  return _result317.GetSuccess(), nil
}
979012
func (s *RegisterUserInput) SetUserRole(v string) *RegisterUserInput {
	s.UserRole = &v
	return s
}
337884
func (_ENSRegistry *ENSRegistrySession) Owner(node [32]byte) (common.Address, error) {
	return _ENSRegistry.Contract.Owner(&_ENSRegistry.CallOpts, node)
}
627923
func (clnt *Client) QueryRoles(policy *AdminPolicy) ([]*Role, error) {
	policy = clnt.getUsableAdminPolicy(policy)

	command := newAdminCommand(nil)
	return command.queryRoles(clnt.cluster, policy)
}
233066
func GetOwnerInfo(ctx, logCtx context.Context, elec *concurrency.Election, id string) (string, error) {
	resp, err := elec.Leader(ctx)
	if err != nil {
		// If no leader elected currently, it returns ErrElectionNoLeader.
		logutil.Logger(logCtx).Info("failed to get leader", zap.Error(err))
		return "", errors.Trace(err)
	}
	ownerID := string(resp.Kvs[0].Value)
	logutil.Logger(logCtx).Info("get owner", zap.String("ownerID", ownerID))
	if ownerID != id {
		logutil.Logger(logCtx).Warn("is not the owner")
		return "", errors.New("ownerInfoNotMatch")
	}

	return string(resp.Kvs[0].Key), nil
}
787763
func (api *API) UserAccessRule(accessRuleID string) (*AccessRuleResponse, error) {
	return api.retrieveAccessRule("/user", accessRuleID)
}