func (self *Permissions) AuthorizeDeleteQuery(user common.User, db string) (ok bool, err common.AuthorizationError) { if !user.IsDbAdmin(db) { return false, common.NewAuthorizationError("Insufficient permission to write to %s", db) } return true, "" }
func (self *Permissions) AuthorizeListContinuousQueries(user common.User, db string) (ok bool, err common.AuthorizationError) { if !user.IsDbAdmin(db) { return false, common.NewAuthorizationError("Insufficient permissions to list continuous queries") } return true, "" }
func (self *Permissions) AuthorizeDropSeries(user common.User, db string, seriesName string) (ok bool, err common.AuthorizationError) { if !user.IsDbAdmin(db) && !user.HasWriteAccess(seriesName) { return false, common.NewAuthorizationError("Insufficient permissions to drop series") } return true, "" }
func (self *Permissions) AuthorizeGrantDbUserAdmin(user common.User, db string) (ok bool, err common.AuthorizationError) { if !user.IsDbAdmin(db) { return false, common.NewAuthorizationError("Insufficient permissions to grant db user admin privileges on %s", db) } return true, "" }
func (self *Permissions) AuthorizeChangeDbUserPermissions(user common.User, db string) (ok bool, err common.AuthorizationError) { if !user.IsDbAdmin(db) { return false, common.NewAuthorizationError("Insufficient permissions to change db user permissions on %s", db) } return true, "" }
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, "" }