当前位置: 首页>>代码示例>>Golang>>正文


Golang QuerySpec.User方法代码示例

本文整理汇总了Golang中parser.QuerySpec.User方法的典型用法代码示例。如果您正苦于以下问题:Golang QuerySpec.User方法的具体用法?Golang QuerySpec.User怎么用?Golang QuerySpec.User使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在parser.QuerySpec的用法示例。


在下文中一共展示了QuerySpec.User方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: runDeleteQuery

func (self *CoordinatorImpl) runDeleteQuery(querySpec *parser.QuerySpec, seriesWriter SeriesWriter) error {
	db := querySpec.Database()
	if !querySpec.User().IsDbAdmin(db) {
		return common.NewAuthorizationError("Insufficient permission to write to %s", db)
	}
	querySpec.RunAgainstAllServersInShard = true
	return self.runQuerySpec(querySpec, seriesWriter)
}
开发者ID:rramos,项目名称:influxdb,代码行数:8,代码来源:coordinator.go

示例2: runDeleteQuery

func (self *CoordinatorImpl) runDeleteQuery(querySpec *parser.QuerySpec, seriesWriter SeriesWriter) error {
	user := querySpec.User()
	db := querySpec.Database()
	if ok, err := self.permissions.AuthorizeDeleteQuery(user, db); !ok {
		return err
	}
	querySpec.RunAgainstAllServersInShard = true
	return self.runQuerySpec(querySpec, seriesWriter)
}
开发者ID:hanshenu,项目名称:influxdb,代码行数:9,代码来源:coordinator.go

示例3: runDropSeriesQuery

func (self *CoordinatorImpl) runDropSeriesQuery(querySpec *parser.QuerySpec, seriesWriter SeriesWriter) error {
	user := querySpec.User()
	db := querySpec.Database()
	series := querySpec.Query().DropSeriesQuery.GetTableName()
	if !user.IsClusterAdmin() && !user.IsDbAdmin(db) && !user.HasWriteAccess(series) {
		return common.NewAuthorizationError("Insufficient permissions to drop series")
	}
	querySpec.RunAgainstAllServersInShard = true
	return self.runQuerySpec(querySpec, seriesWriter)
}
开发者ID:qz267,项目名称:influxdb,代码行数:10,代码来源:coordinator.go

示例4: runDropSeriesQuery

func (self *CoordinatorImpl) runDropSeriesQuery(querySpec *parser.QuerySpec, seriesWriter SeriesWriter) error {
	user := querySpec.User()
	db := querySpec.Database()
	series := querySpec.Query().DropSeriesQuery.GetTableName()
	if ok, err := self.permissions.AuthorizeDropSeries(user, db, series); !ok {
		return err
	}
	querySpec.RunAgainstAllServersInShard = true
	return self.runQuerySpec(querySpec, seriesWriter)
}
开发者ID:hanshenu,项目名称:influxdb,代码行数:10,代码来源:coordinator.go

示例5: createRequest

func (self *ShardData) createRequest(querySpec *parser.QuerySpec) *p.Request {
	queryString := querySpec.GetQueryString()
	user := querySpec.User()
	userName := user.GetName()
	database := querySpec.Database()
	isDbUser := !user.IsClusterAdmin()

	return &p.Request{
		Type:     &queryRequest,
		ShardId:  &self.id,
		Query:    &queryString,
		UserName: &userName,
		Database: &database,
		IsDbUser: &isDbUser,
	}
}
开发者ID:jhermann,项目名称:influxdb,代码行数:16,代码来源:shard.go

示例6: runDropSeriesQuery

func (self *CoordinatorImpl) runDropSeriesQuery(querySpec *parser.QuerySpec, seriesWriter SeriesWriter) error {
	user := querySpec.User()
	db := querySpec.Database()
	series := querySpec.Query().DropSeriesQuery.GetTableName()
	if ok, err := self.permissions.AuthorizeDropSeries(user, db, series); !ok {
		return err
	}
	defer seriesWriter.Close()
	fmt.Println("DROP series")
	err := self.raftServer.DropSeries(db, series)
	if err != nil {
		return err
	}
	fmt.Println("DROP returning nil")
	return nil
}
开发者ID:jhermann,项目名称:influxdb,代码行数:16,代码来源:coordinator.go


注:本文中的parser.QuerySpec.User方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。