Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Hiboo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
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
cyrinux
Hiboo
Commits
069b8364
Verified
Commit
069b8364
authored
8 months ago
by
ornanovitch
Committed by
ornanovitch
5 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Merge branch '58-pouvoir-supprimer-un-profil-non-reclame' into 'dev'
Resolve "Pouvoir supprimer un profil non réclamé" Closes
#58
and
#39
See merge request
!80
parent
0049ff4b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
hiboo/actions.py
+0
-20
0 additions, 20 deletions
hiboo/actions.py
hiboo/models.py
+6
-3
6 additions, 3 deletions
hiboo/models.py
hiboo/profile/views.py
+3
-22
3 additions, 22 deletions
hiboo/profile/views.py
with
9 additions
and
45 deletions
hiboo/actions.py
+
0
−
20
View file @
069b8364
...
...
@@ -86,23 +86,3 @@ class CancelTransition(Action):
def
authorized
(
self
,
profile
):
return
profile
.
transition_step
class
Assign
(
Action
):
"""
Assign a claimable profile
"""
action
=
"
profile.assign
"
label
=
(
_
(
"
assign
"
))
description
=
(
_
(
"
assign the profile to a user
"
))
icon
=
""
def
url
(
self
,
profile
):
return
super
(
Assign
,
self
).
url
(
profile_uuid
=
profile
.
uuid
)
def
authorized
(
self
,
profile
):
return
(
flask_login
.
current_user
.
is_admin
and
profile
.
status
==
profile
.
UNCLAIMED
)
This diff is collapsed.
Click to expand it.
hiboo/models.py
+
6
−
3
View file @
069b8364
...
...
@@ -253,6 +253,10 @@ class Profile(db.Model):
}
TRANSITIONS
=
{
"
assign
"
:
actions
.
Transition
(
"
assign
"
,
label
=
(
_
(
"
assign
"
)),
description
=
(
_
(
"
assign this profile to a user
"
)),
icon
=
"
fas fa-people-arrows
"
,
from_
=
(
UNCLAIMED
,),
to
=
ACTIVE
),
"
activate
"
:
actions
.
Transition
(
"
activate
"
,
label
=
(
_
(
"
activate
"
)),
description
=
(
_
(
"
activate this profile
"
)),
icon
=
"
fas fa-user-check
"
,
from_
=
(
REQUEST
,),
to
=
ACTIVE
...
...
@@ -276,10 +280,9 @@ class Profile(db.Model):
),
"
purge
"
:
actions
.
Transition
(
"
purge
"
,
label
=
(
_
(
"
purge
"
)),
description
=
(
_
(
"
delete and purge this profile
"
)),
icon
=
"
fas fa-trash
"
,
from_
=
(
ACTIVE
,
BLOCKED
,
DELETED
),
to
=
PURGED
,
icon
=
"
fas fa-trash
"
,
from_
=
(
UNCLAIMED
,
ACTIVE
,
BLOCKED
,
DELETED
),
to
=
PURGED
,
delay
=
120
),
"
assign
"
:
actions
.
Assign
()
)
}
user_uuid
=
db
.
Column
(
db
.
String
(
36
),
db
.
ForeignKey
(
User
.
uuid
))
...
...
This diff is collapsed.
Click to expand it.
hiboo/profile/views.py
+
3
−
22
View file @
069b8364
...
...
@@ -197,6 +197,9 @@ def start_transition(profile_uuid, transition_id):
actor
=
flask_login
.
current_user
,
public
=
True
)
if
transition_id
==
"
assign
"
:
user
=
hiboo_user
.
get_user
(
intent
=
"
profile.start_transition
"
,
profile_uuid
=
profile_uuid
)
profile
.
user_uuid
=
user
.
uuid
models
.
db
.
session
.
commit
()
flask
.
flash
(
_
(
"
Profile status change was requested
"
),
"
success
"
)
if
transition_id
==
"
delete
"
and
flask_login
.
current_user
.
is_admin
==
False
or
transition_id
==
"
purge
"
and
not
flask_login
.
current_user
.
is_admin
:
...
...
@@ -228,25 +231,3 @@ def complete_transition(profile_uuid):
models
.
db
.
session
.
commit
()
flask
.
flash
(
_
(
"
Profile status change was completed
"
),
"
success
"
)
return
flask
.
redirect
(
flask
.
url_for
(
"
.details
"
,
profile_uuid
=
profile_uuid
))
@blueprint.route
(
"
/assign/<profile_uuid>
"
,
methods
=
[
"
GET
"
,
"
POST
"
])
@security.admin_required
()
def
assign
(
profile_uuid
):
profile
=
models
.
Profile
.
query
.
get
(
profile_uuid
)
or
flask
.
abort
(
404
)
assert
profile
.
status
==
models
.
Profile
.
UNCLAIMED
user
=
hiboo_user
.
get_user
(
intent
=
"
profile.assign
"
,
profile_uuid
=
profile_uuid
)
profile
.
user_uuid
=
user
.
uuid
profile
.
status
=
models
.
Profile
.
ACTIVE
models
.
log
(
category
=
models
.
History
.
STATUS
,
value
=
models
.
Profile
.
ACTIVE
,
user
=
user
,
service
=
profile
.
service
,
profile
=
profile
,
actor
=
flask_login
.
current_user
,
public
=
True
)
models
.
db
.
session
.
commit
()
flask
.
flash
(
_
(
"
Successfully assigned the profile
"
),
"
success
"
)
return
flask
.
redirect
(
flask
.
url_for
(
"
.details
"
,
profile_uuid
=
profile_uuid
))
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