mirror of
https://github.com/cuigh/swirl
synced 2024-12-28 14:51:57 +00:00
Refresh session when user or role is updated
This commit is contained in:
parent
d0eb101aee
commit
48fdc6e094
10
biz/role.go
10
biz/role.go
@ -50,7 +50,10 @@ func (b *roleBiz) Create(role *dao.Role, user web.User) (err error) {
|
||||
func (b *roleBiz) Delete(id, name string, user web.User) (err error) {
|
||||
err = b.d.RoleDelete(context.TODO(), id)
|
||||
if err == nil {
|
||||
b.eb.CreateRole(EventActionDelete, id, name, user)
|
||||
go func() {
|
||||
_ = b.d.SessionUpdateDirty(context.TODO(), "", id)
|
||||
b.eb.CreateRole(EventActionDelete, id, name, user)
|
||||
}()
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -70,7 +73,10 @@ func (b *roleBiz) Update(role *dao.Role, user web.User) (err error) {
|
||||
}
|
||||
err = b.d.RoleUpdate(context.TODO(), r)
|
||||
if err == nil {
|
||||
b.eb.CreateRole(EventActionUpdate, role.ID, role.Name, user)
|
||||
go func() {
|
||||
_ = b.d.SessionUpdateDirty(context.TODO(), "", role.ID)
|
||||
b.eb.CreateRole(EventActionUpdate, role.ID, role.Name, user)
|
||||
}()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -126,7 +126,10 @@ func (b *userBiz) Update(user *dao.User, ctxUser web.User) (err error) {
|
||||
user.UpdatedAt = now()
|
||||
user.UpdatedBy = newOperator(ctxUser)
|
||||
if err = b.d.UserUpdate(context.TODO(), user); err == nil {
|
||||
b.eb.CreateUser(EventActionUpdate, user.LoginName, user.Name, ctxUser)
|
||||
go func() {
|
||||
_ = b.d.SessionUpdateDirty(context.TODO(), user.ID, "")
|
||||
b.eb.CreateUser(EventActionUpdate, user.LoginName, user.Name, ctxUser)
|
||||
}()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ function renderObject(e: Event) {
|
||||
return renderLink({ name: e.type.toLowerCase() + '_detail', params: { name: e.args.name } }, e.args.name)
|
||||
case "Image":
|
||||
if (e.args.id) {
|
||||
return renderLink({ name: 'image_detail', params: { node: e.args.node || '-', id: e.args.id } }, e.args.id)
|
||||
return renderLink({ name: 'image_detail', params: { node: e.args.node || '-', id: e.args.id } }, e.args.id.substring(7, 19))
|
||||
} else {
|
||||
return renderLink({ name: 'image_list' }, t('objects.image'))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user