Skip to content
Snippets Groups Projects
Commit 6e44e1dd authored by kaiyou's avatar kaiyou
Browse files

Add some more consistent logging

parent c1be16cd
No related branches found
No related tags found
No related merge requests found
...@@ -45,7 +45,7 @@ def set_status(profile_uuid, status): ...@@ -45,7 +45,7 @@ def set_status(profile_uuid, status):
service=profile.service, service=profile.service,
profile=profile, profile=profile,
actor=flask_login.current_user, actor=flask_login.current_user,
public=False public=True
) )
models.db.session.commit() models.db.session.commit()
flask.flash(_("Profile status was successfully changed"), "success") flask.flash(_("Profile status was successfully changed"), "success")
...@@ -56,10 +56,19 @@ def set_status(profile_uuid, status): ...@@ -56,10 +56,19 @@ def set_status(profile_uuid, status):
@security.admin_required() @security.admin_required()
def assign(profile_uuid): def assign(profile_uuid):
profile = models.Profile.query.get(profile_uuid) or flask.abort(404) profile = models.Profile.query.get(profile_uuid) or flask.abort(404)
assert profile.status == "unclaimed" assert profile.status == models.Profile.UNCLAIMED
user = hiboo_user.get_user(intent="profile.assign", profile_uuid=profile_uuid) user = hiboo_user.get_user(intent="profile.assign", profile_uuid=profile_uuid)
profile.user_uuid = user.uuid profile.user_uuid = user.uuid
profile.status = "active" profile.status = models.Profile.ACTIVE
models.log(
category=models.History.STATUS,
value=models.Profile.ACIVE,
user=user,
service=profile.service,
profile=profile,
actor=flask_login.current_user,
public=True
)
models.db.session.commit() models.db.session.commit()
flask.flash(_("Successfully assigned the profile"), "success") flask.flash(_("Successfully assigned the profile"), "success")
return flask.redirect(flask.url_for(".details", profile_uuid=profile_uuid)) return flask.redirect(flask.url_for(".details", profile_uuid=profile_uuid))
...@@ -96,6 +96,15 @@ def claim(service_uuid): ...@@ -96,6 +96,15 @@ def claim(service_uuid):
profile.status = models.Profile.ACTIVE profile.status = models.Profile.ACTIVE
del profile.extra["password"] del profile.extra["password"]
models.db.session.add(profile) models.db.session.add(profile)
models.log(
category=models.History.STATUS,
value=models.Profile.ACTIVE,
user=profile.user,
service=service,
profile=profile,
actor=flask_login.current_user,
public=True
)
models.db.session.commit() models.db.session.commit()
flask.flash(_("Successfully claimed the profile!"), "success") flask.flash(_("Successfully claimed the profile!"), "success")
return flask.redirect(utils.url_or_intent("account.home")) return flask.redirect(utils.url_or_intent("account.home"))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment