Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
goSDN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
danet
goSDN
Commits
f0d4d76d
Commit
f0d4d76d
authored
3 years ago
by
Fabian Seidl
Browse files
Options
Downloads
Patches
Plain Diff
updated some todo comments
parent
4f572e10
No related branches found
No related tags found
1 merge request
!287
Implement data persisting for user management
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cli/cmd/utils.go
+1
-1
1 addition, 1 deletion
cli/cmd/utils.go
controller/northbound/server/auth.go
+4
-6
4 additions, 6 deletions
controller/northbound/server/auth.go
with
5 additions
and
7 deletions
cli/cmd/utils.go
+
1
−
1
View file @
f0d4d76d
...
...
@@ -102,7 +102,7 @@ func getChangesByType(cType pnd.ChangeState) []prompt.Suggest {
}
func
createContextWithAuthorization
()
context
.
Context
{
//TODO
(faseid)
: try to get token string first, if "" return err, followed by print in cli about required login
//TODO: try to get token string first, if "" return err, followed by print in cli about required login
md
:=
metadata
.
Pairs
(
"authorize"
,
userToken
)
return
metadata
.
NewOutgoingContext
(
context
.
Background
(),
md
)
}
This diff is collapsed.
Click to expand it.
controller/northbound/server/auth.go
+
4
−
6
View file @
f0d4d76d
...
...
@@ -53,7 +53,6 @@ func (s Auth) Login(ctx context.Context, request *apb.LoginRequest) (*apb.LoginR
return
nil
,
err
}
//TODO: add session handling here, update user with token
userToUpdate
,
err
:=
userc
.
Get
(
store
.
Query
{
Name
:
user
.
UserName
})
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -94,7 +93,7 @@ func (s Auth) CreateUsers(ctx context.Context, request *apb.CreateUsersRequest)
start
:=
metrics
.
StartHook
(
labels
,
grpcRequestsTotal
)
defer
metrics
.
FinishHook
(
labels
,
start
,
grpcRequestDurationSecondsTotal
,
grpcRequestDurationSeconds
)
// TODO
(faseid)
: implement check if user is allowed to create users with this role
// TODO: implement check if user is allowed to create users with this role
// e.g. non-admin shouldn't be allowed to create admin users
for
_
,
u
:=
range
request
.
User
{
roles
:=
map
[
string
]
string
{}
...
...
@@ -126,7 +125,7 @@ func (s Auth) GetUser(ctx context.Context, request *apb.GetUserRequest) (*apb.Ge
start
:=
metrics
.
StartHook
(
labels
,
grpcRequestsTotal
)
defer
metrics
.
FinishHook
(
labels
,
start
,
grpcRequestDurationSecondsTotal
,
grpcRequestDurationSeconds
)
// TODO
(faseid)
: implement check if user is allowed to get this user data; only their own if not admin
// TODO: implement check if user is allowed to get this user data; only their own if not admin
userData
,
err
:=
userc
.
Get
(
store
.
Query
{
Name
:
request
.
Name
})
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -178,7 +177,7 @@ func (s Auth) UpdateUsers(ctx context.Context, request *apb.UpdateUsersRequest)
start
:=
metrics
.
StartHook
(
labels
,
grpcRequestsTotal
)
defer
metrics
.
FinishHook
(
labels
,
start
,
grpcRequestDurationSecondsTotal
,
grpcRequestDurationSeconds
)
// TODO
(faseid)
: check if current user is allowed to update the user they try to update; only their own if not admin
// TODO: check if current user is allowed to update the user they try to update; only their own if not admin
for
_
,
u
:=
range
request
.
User
{
uid
,
err
:=
uuid
.
Parse
(
u
.
Id
)
if
err
!=
nil
{
...
...
@@ -323,7 +322,7 @@ func (s Auth) UpdateRoles(ctx context.Context, request *apb.UpdateRolesRequest)
start
:=
metrics
.
StartHook
(
labels
,
grpcRequestsTotal
)
defer
metrics
.
FinishHook
(
labels
,
start
,
grpcRequestDurationSecondsTotal
,
grpcRequestDurationSeconds
)
// TODO
(faseid)
: check if current user is allowed to update the role they try to update; only their own if not admin
// TODO: check if current user is allowed to update the role they try to update; only their own if not admin
for
_
,
r
:=
range
request
.
Roles
{
rid
,
err
:=
uuid
.
Parse
(
r
.
Id
)
if
err
!=
nil
{
...
...
@@ -373,7 +372,6 @@ func (s Auth) DeletePermissionsForRole(ctx context.Context, request *apb.DeleteP
break
}
}
if
nonFound
{
return
nil
,
status
.
Errorf
(
codes
.
Canceled
,
"no fitting permissions"
)
}
...
...
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