// GetOwnerID implements Manager.GetOwnerID interface.
483890
func (m *mockManager) GetOwnerID(ctx context.Context) (string, error) {
	if m.IsOwner() {
		return m.ID(), nil
	}
	return "", errors.New("no owner")
}
892270
func GetControllerOf(controllee Object) *OwnerReference {
	for _, ref := range controllee.GetOwnerReferences() {
		if ref.Controller != nil && *ref.Controller {
			return &ref
		}
	}
	return nil
}
573558
func (m *Manager) isDirectOwner(globalID, username string) (isowner bool, err error) {
	matches, err := m.collection.Find(bson.M{"globalid": globalID, "owners": username}).Count()
	isowner = (matches > 0)
	return
}
1316724
func (s *EC2SecurityGroup) SetEC2SecurityGroupOwnerId(v string) *EC2SecurityGroup {
	s.EC2SecurityGroupOwnerId = &v
	return s
}
226299
func parseOwnerAndRepo(c *context.APIContext) (*models.User, *models.Repository) {
	owner, err := models.GetUserByName(c.Params(":username"))
	if err != nil {
		if errors.IsUserNotExist(err) {
			c.Error(422, "", err)
		} else {
			c.Error(500, "GetUserByName", err)
		}
		return nil, nil
	}

	repo, err := models.GetRepositoryByName(owner.ID, c.Params(":reponame"))
	if err != nil {
		if errors.IsRepoNotExist(err) {
			c.Status(404)
		} else {
			c.Error(500, "GetRepositoryByName", err)
		}
		return nil, nil
	}

	return owner, repo
}
790893
func (s *NFSFileShareDefaults) SetOwnerId(v int64) *NFSFileShareDefaults {
	s.OwnerId = &v
	return s
}
283274
func (s *SharedDirectory) SetOwnerDirectoryId(v string) *SharedDirectory {
	s.OwnerDirectoryId = &v
	return s
}
21194
func (obj *Doc) GetDatabaseOwnersRaw(ctx context.Context, connectionId string, database string) (json.RawMessage, error) {
	result := &struct {
		Owners json.RawMessage	`json:"qOwners"`
	} {}
	err := obj.rpc(ctx, "GetDatabaseOwners", result, ensureEncodable(connectionId), ensureEncodable(database))
	return result.Owners, err 
}
547051
func getOwner(login string, lookupUser LookupUser, lookupGroup LookupGroup) (int, int, os.FileMode, error) {
	var err error
	var uid int
	var gid int
	var mode os.FileMode

	// Lookup the Unix login for the UID and fallback GID.
	u, err := lookupUser(login)
	if err != nil {
		return 0, 0, 0, trace.Wrap(err)
	}
	uid, err = strconv.Atoi(u.Uid)
	if err != nil {
		return 0, 0, 0, trace.Wrap(err)
	}

	// If the tty group exists, use that as the gid of the TTY and set mode to
	// be u+rw. Otherwise use the group of the user with mode u+rw g+w.
	group, err := lookupGroup("tty")
	if err != nil {
		gid, err = strconv.Atoi(u.Gid)
		if err != nil {
			return 0, 0, 0, trace.Wrap(err)
		}
		mode = 0620
	} else {
		gid, err = strconv.Atoi(group.Gid)
		if err != nil {
			return 0, 0, 0, trace.Wrap(err)
		}
		mode = 0600
	}

	return uid, gid, mode, nil
}
233506
func (o *OrderGetParams) WithOrderID(orderID int64) *OrderGetParams {
	o.SetOrderID(orderID)
	return o
}
1032283
func (s *AwsS3BucketDetails) SetOwnerId(v string) *AwsS3BucketDetails {
	s.OwnerId = &v
	return s
}
1335443
func (s *GitServer) GetRepoByOwner(owner, name string) (provider.Repo, error) {
	r := &Repo{}
	repo, _, err := s.client.Repositories.Get(s.ctx, owner, name)
	if err != nil {
		local.Printf("Unable to find repo [%s/%s]", owner, name)
		return r, err
	}
	if repo == nil {
		return r, nil
	}
	r.impl = repo
	r.assumedOwner = owner
	if *repo.Fork && repo.Parent.Owner != nil {
		r.forkedFrom = &Repo{impl: repo.Parent}
	}
	return r, nil

}
246953
func (c *Client) GetTenantID(serviceID string) (string, error) {
	tenantID := ""
	err := c.call("GetTenantID", serviceID, &tenantID)
	return tenantID, err
}
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
}
507748
func (p *Project) GetOwnerURL() string {
	if p == nil || p.OwnerURL == nil {
		return ""
	}
	return *p.OwnerURL
}
1348529
func (st *State) ControllerOwner() (names.UserTag, error) {
	models, closer := st.db().GetCollection(modelsC)
	defer closer()
	var doc map[string]string
	err := models.FindId(st.ControllerModelUUID()).Select(bson.M{"owner": 1}).One(&doc)
	if err != nil {
		return names.UserTag{}, errors.Annotate(err, "loading controller model")
	}
	owner := doc["owner"]
	if owner == "" {
		return names.UserTag{}, errors.New("model owner missing")
	}
	return names.NewUserTag(owner), nil
}
880708
func (s *FileSystemDescription) SetOwnerId(v string) *FileSystemDescription {
	s.OwnerId = &v
	return s
}