Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
image board
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
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
random asynchronous nightmare distributor
image board
Commits
1a987c9e
Commit
1a987c9e
authored
Oct 6, 2021
by
Ophestra
Browse files
Options
Downloads
Patches
Plain Diff
set user privileged through API
parent
5c0d5069
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
api.go
+3
-0
3 additions, 0 deletions
api.go
api/types.go
+2
-1
2 additions, 1 deletion
api/types.go
client/user.go
+2
-2
2 additions, 2 deletions
client/user.go
with
7 additions
and
3 deletions
api.go
+
3
−
0
View file @
1a987c9e
...
...
@@ -118,6 +118,9 @@ func registerAPI() {
return
}
if
info
.
Privileged
{
instance
.
UserPrivileged
(
flake
,
payload
.
Privileged
)
}
instance
.
UserUsernameUpdate
(
flake
,
payload
.
Username
)
})
...
...
This diff is collapsed.
Click to expand it.
api/types.go
+
2
−
1
View file @
1a987c9e
...
...
@@ -14,6 +14,7 @@ type UserCreatePayload struct {
type
UserUpdatePayload
struct
{
Username
string
`json:"username"`
Privileged
bool
`json:"privileged,omitempty"`
}
type
UserSecretPayload
struct
{
...
...
This diff is collapsed.
Click to expand it.
client/user.go
+
2
−
2
View file @
1a987c9e
...
...
@@ -52,10 +52,10 @@ func (r *Remote) UserAdd(username string, password string, privileged bool) (sto
}
// UserUpdate updates a user.
func
(
r
*
Remote
)
UserUpdate
(
flake
,
newname
string
)
error
{
func
(
r
*
Remote
)
UserUpdate
(
flake
,
newname
string
,
privileged
bool
)
error
{
return
r
.
requestJSONnoResp
(
http
.
MethodPatch
,
populateField
(
api
.
UserField
,
"flake"
,
flake
),
api
.
UserUpdatePayload
{
Username
:
newname
})
api
.
UserUpdatePayload
{
Username
:
newname
,
Privileged
:
privileged
})
}
// UserDestroy destroys a user.
...
...
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