本文整理汇总了Golang中github.com/Wikia/influxdb/common.User.GetName方法的典型用法代码示例。如果您正苦于以下问题:Golang User.GetName方法的具体用法?Golang User.GetName怎么用?Golang User.GetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/Wikia/influxdb/common.User
的用法示例。
在下文中一共展示了User.GetName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: AuthorizeChangeDbUserPassword
func (self *Permissions) AuthorizeChangeDbUserPassword(user common.User, db string, targetUsername string) (ok bool, err common.AuthorizationError) {
if !user.IsDbAdmin(db) && !(user.GetDb() == db && user.GetName() == targetUsername) {
return false, common.NewAuthorizationError("Insufficient permissions to change db user password for %s on %s", targetUsername, db)
}
return true, ""
}
示例2: RunQueryWithContext
func (self *Coordinator) RunQueryWithContext(user common.User, database string, queryString string, p engine.Processor, requestContext *api.RequestContext) (err error) {
log.Info("Start Query: db: %s, u: %s, q: %s", database, user.GetName(), queryString)
runningQuery := NewRunningQuery(user.GetName(), database, queryString, time.Now(), requestContext.RemoteAddr())
self.monitor.StartQuery(runningQuery)
defer func() {
self.monitor.EndQuery(runningQuery)
}()
defer func(t time.Time) {
log.Debug("End Query: db: %s, u: %s, q: %s, t: %s", database, user.GetName(), queryString, time.Now().Sub(t))
}(time.Now())
// don't let a panic pass beyond RunQuery
defer common.RecoverFunc(database, queryString, nil)
q, err := parser.ParseQuery(queryString)
if err != nil {
return err
}
for _, query := range q {
err := self.runSingleQuery(user, database, query, p)
if err != nil {
return err
}
}
return nil
}
示例3: WriteSeriesData
func (self *Coordinator) WriteSeriesData(user common.User, db string, series []*protocol.Series) error {
// make sure that the db exist
if !self.clusterConfiguration.DatabasesExists(db) {
return fmt.Errorf("Database %s doesn't exist", db)
}
for _, s := range series {
seriesName := s.GetName()
if user.HasWriteAccess(seriesName) {
continue
}
return common.NewAuthorizationError("User %s doesn't have write permissions for %s", user.GetName(), seriesName)
}
err := self.CommitSeriesData(db, series, false)
if err != nil {
return err
}
for _, s := range series {
self.ProcessContinuousQueries(db, s)
}
return err
}