Enable authentication tokens on SCOPES

This commit is contained in:
Tobie Morgan Hitchcock 2016-11-21 18:58:07 +00:00
parent 2783c4c653
commit 5bfe938fcf

View file

@ -22,7 +22,7 @@ func (p *parser) parseDefineTokenStatement() (stmt *DefineTokenStatement, err er
return nil, err
}
if stmt.Kind, _, err = p.shouldBe(NAMESPACE, DATABASE); err != nil {
if stmt.Kind, _, err = p.shouldBe(NAMESPACE, DATABASE, SCOPE); err != nil {
return nil, err
}
@ -38,6 +38,12 @@ func (p *parser) parseDefineTokenStatement() (stmt *DefineTokenStatement, err er
}
}
if p.is(stmt.Kind, SCOPE) {
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
return nil, err
}
}
if _, _, err = p.shouldBe(EOF, SEMICOLON); err != nil {
return nil, err
}
@ -54,7 +60,7 @@ func (p *parser) parseRemoveTokenStatement() (stmt *RemoveTokenStatement, err er
return nil, err
}
if stmt.Kind, _, err = p.shouldBe(NAMESPACE, DATABASE); err != nil {
if stmt.Kind, _, err = p.shouldBe(NAMESPACE, DATABASE, SCOPE); err != nil {
return nil, err
}
@ -70,6 +76,12 @@ func (p *parser) parseRemoveTokenStatement() (stmt *RemoveTokenStatement, err er
}
}
if p.is(stmt.Kind, SCOPE) {
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
return nil, err
}
}
if _, _, err = p.shouldBe(EOF, SEMICOLON); err != nil {
return nil, err
}