Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
Hiboo
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
frju365
Hiboo
Commits
9cdb8861
Commit
9cdb8861
authored
5 years ago
by
kaiyou
Browse files
Options
Downloads
Patches
Plain Diff
Add an api for creating and promoting users
parent
2a2caf19
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hiboo/user/__init__.py
+1
-1
1 addition, 1 deletion
hiboo/user/__init__.py
hiboo/user/cli.py
+29
-0
29 additions, 0 deletions
hiboo/user/cli.py
with
30 additions
and
1 deletion
hiboo/user/__init__.py
+
1
−
1
View file @
9cdb8861
...
...
@@ -4,7 +4,7 @@ import flask
blueprint
=
flask
.
Blueprint
(
"
user
"
,
__name__
,
template_folder
=
"
templates
"
)
from
hiboo
import
models
,
utils
from
hiboo.user
import
users
from
hiboo.user
import
users
,
cli
def
get_user
(
**
redirect_args
):
...
...
This diff is collapsed.
Click to expand it.
hiboo/user/cli.py
0 → 100644
+
29
−
0
View file @
9cdb8861
from
hiboo.user
import
blueprint
from
hiboo
import
models
import
click
@blueprint.cli.command
()
@click.argument
(
"
username
"
)
@click.argument
(
"
password
"
)
def
create
(
username
,
password
):
assert
not
models
.
User
.
query
.
filter_by
(
username
=
username
).
first
()
auth
=
models
.
Auth
()
auth
.
set_password
(
password
)
user
=
models
.
User
(
username
=
username
,
auths
=
[
auth
]
)
models
.
db
.
session
.
add
(
auth
)
models
.
db
.
session
.
add
(
user
)
models
.
db
.
session
.
commit
()
@blueprint.cli.command
()
@click.argument
(
"
username
"
)
def
promote
(
username
):
user
=
models
.
User
.
query
.
filter_by
(
username
=
username
).
first
()
assert
user
user
.
is_admin
=
True
models
.
db
.
session
.
commit
()
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