scopes
2015-12-13
Parent:b93938562a17
scopes/types/scope.go
Port over Postgres storage and tests. Do the minimum possible port of the code from auth to get Postgres working and make the tests run and pass again. This leaves a bug where the ErrScopeAlreadyExists type, when populatd from Postgres, contains the entire error string returned from the database, instead of parsing the ID itself out. Which is a thing we should do and add a test for.
1.1 --- a/types/scope.go Sat Dec 05 15:00:34 2015 -0800 1.2 +++ b/types/scope.go Sun Dec 13 20:42:48 2015 -0800 1.3 @@ -50,3 +50,11 @@ 1.4 func (s ScopeChange) Empty() bool { 1.5 return s.Name == nil && s.Description == nil 1.6 } 1.7 + 1.8 +func StringsToScopes(s []string) Scopes { 1.9 + res := make(Scopes, len(s)) 1.10 + for pos, scope := range s { 1.11 + res[pos] = Scope{ID: scope} 1.12 + } 1.13 + return res 1.14 +}