Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
invinoveritas
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
gbe
invinoveritas
Commits
787fb0b8
Commit
787fb0b8
authored
3 years ago
by
gbe
Browse files
Options
Downloads
Patches
Plain Diff
even more cleanups
parent
6f53e6db
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
db.go
+0
-1
0 additions, 1 deletion
db.go
session/authprovider.go
+9
-9
9 additions, 9 deletions
session/authprovider.go
storage/db_test.go
+0
-25
0 additions, 25 deletions
storage/db_test.go
vino/vino.go
+0
-5
0 additions, 5 deletions
vino/vino.go
with
9 additions
and
40 deletions
db.go
deleted
100644 → 0
+
0
−
1
View file @
6f53e6db
package
main
This diff is collapsed.
Click to expand it.
session/authprovider.go
+
9
−
9
View file @
787fb0b8
...
...
@@ -48,7 +48,7 @@ type Info struct {
}
type
Provider
struct
{
Q
*
query
.
Queries
q
*
query
.
Queries
}
func
NewProvider
(
ctx
context
.
Context
,
q
*
query
.
Queries
)
(
Provider
,
error
)
{
...
...
@@ -84,7 +84,7 @@ func NewProvider(ctx context.Context, q *query.Queries) (Provider, error) {
}
return
Provider
{
Q
:
q
,
q
:
q
,
},
nil
}
...
...
@@ -96,7 +96,7 @@ func (a Provider) Valid(ctx context.Context, token string) (*auth.User, error) {
err
error
)
err
=
a
.
Q
.
RunTx
(
ctx
,
func
(
q
*
query
.
Queries
)
error
{
err
=
a
.
q
.
RunTx
(
ctx
,
func
(
q
*
query
.
Queries
)
error
{
user
.
Name
,
err
=
q
.
IsValidSession
(
ctx
,
token
)
if
errors
.
Is
(
err
,
sql
.
ErrNoRows
)
{
// Let's see if there are any users at all. If not, we let 'em in.
...
...
@@ -162,7 +162,7 @@ func (a Provider) Handler(templateFS fs.FS) http.Handler {
var
token
string
err
:=
a
.
Q
.
RunTx
(
r
.
Context
(),
func
(
q
*
query
.
Queries
)
error
{
err
:=
a
.
q
.
RunTx
(
r
.
Context
(),
func
(
q
*
query
.
Queries
)
error
{
userData
,
err
:=
q
.
GetAuthData
(
r
.
Context
(),
userName
)
if
errors
.
Is
(
err
,
sql
.
ErrNoRows
)
{
// Either no such user or no users at all
...
...
@@ -289,11 +289,11 @@ func (a Provider) createSession(ctx context.Context, q *query.Queries, userID in
}
func
(
a
Provider
)
DeleteSession
(
ctx
context
.
Context
,
token
string
)
error
{
return
a
.
Q
.
DeleteSession
(
ctx
,
token
)
return
a
.
q
.
DeleteSession
(
ctx
,
token
)
}
func
(
a
Provider
)
ListSessions
(
ctx
context
.
Context
)
([]
Info
,
error
)
{
rows
,
err
:=
a
.
Q
.
ListSessions
(
ctx
)
rows
,
err
:=
a
.
q
.
ListSessions
(
ctx
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -316,11 +316,11 @@ func (a Provider) ListSessions(ctx context.Context) ([]Info, error) {
}
func
(
a
Provider
)
ListUsers
(
ctx
context
.
Context
)
([]
string
,
error
)
{
return
a
.
Q
.
ListUsers
(
ctx
)
return
a
.
q
.
ListUsers
(
ctx
)
}
func
(
a
Provider
)
UpdatePassword
(
ctx
context
.
Context
,
userName
,
passOld
,
passNew
string
,
createNew
bool
)
error
{
err
:=
a
.
Q
.
RunTx
(
ctx
,
func
(
q
*
query
.
Queries
)
error
{
err
:=
a
.
q
.
RunTx
(
ctx
,
func
(
q
*
query
.
Queries
)
error
{
hashedNew
,
err
:=
hashPassword
(
ctx
,
q
,
userName
,
passNew
)
if
err
!=
nil
{
return
err
...
...
@@ -410,5 +410,5 @@ func (a Provider) CreateUser(ctx context.Context, userName string) (string, erro
}
func
(
a
Provider
)
DeleteUser
(
ctx
context
.
Context
,
name
string
)
error
{
return
a
.
Q
.
DeleteUser
(
ctx
,
name
)
return
a
.
q
.
DeleteUser
(
ctx
,
name
)
}
This diff is collapsed.
Click to expand it.
storage/db_test.go
deleted
100644 → 0
+
0
−
25
View file @
6f53e6db
package
storage
import
(
"testing"
_
"modernc.org/sqlite"
)
func
assertNoError
(
t
*
testing
.
T
,
err
error
)
{
if
err
!=
nil
{
t
.
Fatalf
(
"unexpected error: %s"
,
err
)
}
}
func
expectNoError
(
t
*
testing
.
T
,
err
error
)
{
if
err
!=
nil
{
t
.
Errorf
(
"unexpected error: %s"
,
err
)
}
}
func
expectError
(
t
*
testing
.
T
,
err
error
)
{
if
err
==
nil
{
t
.
Error
(
"expected an error"
)
}
}
This diff is collapsed.
Click to expand it.
vino/vino.go
+
0
−
5
View file @
787fb0b8
...
...
@@ -11,11 +11,6 @@ import (
_
"image/png"
)
type
Comment
struct
{
ID
int
`db:"id"`
Content
string
`db:"content"`
}
type
ISO2CountryCode
[
2
]
byte
var
UnknownCountry
=
ISO2CountryCode
{
'X'
,
'X'
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment