Skip to content

Commit

Permalink
Add an additional error code, and fix the error codes for ACL denied
Browse files Browse the repository at this point in the history
  • Loading branch information
aaijazi committed Aug 26, 2015
1 parent 4974cf4 commit 01c80f7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
5 changes: 5 additions & 0 deletions go/vt/proto/vtrpc/vtrpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions go/vt/tabletserver/query_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func (qre *QueryExecutor) checkPermissions() error {
callerID := callerid.ImmediateCallerIDFromContext(qre.ctx)
if callerID == nil {
if qre.qe.strictTableAcl {
return NewTabletError(ErrFail, "missing caller id")
return NewTabletError(ErrFail, vtrpc.ErrorCode_UNAUTHENTICATED, "missing caller id")
}
return nil
}
Expand All @@ -231,7 +231,7 @@ func (qre *QueryExecutor) checkPermissions() error {
return nil
}
if qre.plan.Authorized == nil {
return NewTabletError(ErrFail, "table acl error: nil acl")
return NewTabletError(ErrFail, vtrpc.ErrorCode_PERMISSION_DENIED, "table acl error: nil acl")
}
tableACLStatsKey := []string{
qre.plan.TableName,
Expand Down
4 changes: 4 additions & 0 deletions proto/vtrpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ enum ErrorCode {
// 1. Query has been throttled
// 2. VtGate could have request backlog
TRANSIENT_ERROR = 11;

// UNAUTHENTICATED errors are returned when a user requests access to something,
// and we're unable to verify the user's authentication.
UNAUTHENTICATED = 12;
}

// ErrorCodeDeprecated is the enum values for Errors. These are deprecated errors, we
Expand Down
13 changes: 9 additions & 4 deletions py/vtproto/vtrpc_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 01c80f7

Please sign in to comment.