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) {
|
func (b *roleBiz) Delete(id, name string, user web.User) (err error) {
|
||||||
err = b.d.RoleDelete(context.TODO(), id)
|
err = b.d.RoleDelete(context.TODO(), id)
|
||||||
if err == nil {
|
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
|
return
|
||||||
}
|
}
|
||||||
@ -70,7 +73,10 @@ func (b *roleBiz) Update(role *dao.Role, user web.User) (err error) {
|
|||||||
}
|
}
|
||||||
err = b.d.RoleUpdate(context.TODO(), r)
|
err = b.d.RoleUpdate(context.TODO(), r)
|
||||||
if err == nil {
|
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
|
return
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,10 @@ func (b *userBiz) Update(user *dao.User, ctxUser web.User) (err error) {
|
|||||||
user.UpdatedAt = now()
|
user.UpdatedAt = now()
|
||||||
user.UpdatedBy = newOperator(ctxUser)
|
user.UpdatedBy = newOperator(ctxUser)
|
||||||
if err = b.d.UserUpdate(context.TODO(), user); err == nil {
|
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
|
return
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ function renderObject(e: Event) {
|
|||||||
return renderLink({ name: e.type.toLowerCase() + '_detail', params: { name: e.args.name } }, e.args.name)
|
return renderLink({ name: e.type.toLowerCase() + '_detail', params: { name: e.args.name } }, e.args.name)
|
||||||
case "Image":
|
case "Image":
|
||||||
if (e.args.id) {
|
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 {
|
} else {
|
||||||
return renderLink({ name: 'image_list' }, t('objects.image'))
|
return renderLink({ name: 'image_list' }, t('objects.image'))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user