Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Cascade-delete entities "owned" by User #36

Closed
alexbudarov opened this issue Dec 1, 2020 · 3 comments
Closed

Cascade-delete entities "owned" by User #36

alexbudarov opened this issue Dec 1, 2020 · 3 comments
Assignees
Labels
type: bug Something isn't working
Milestone

Comments

@alexbudarov
Copy link

Security problem:

  • Launch any Jmix app

  • Create user "max", assign system-full-access role.

  • Delete max

  • Create new user "max", don't assign any roles

  • Reopen "max". Oops, he has system-full-access role (left from previous user)

Solution:

  • Determine list of entities in jmix modules that are "owned" by user entity and should be cascade-deleted with it.
  • Develop mechanism of declaring on-user-delete logic in framework's addons.
  • In Jmix project template - implement EntityChanged event listener calling all necessary cascade deletions for attached modules.

Preliminary list of what should be cascade-deleted:

  • sec_role_assignment_entity
  • ui_setting
  • ui_table_presentation
  • saved filters (when they will be implemented)
@alexbudarov alexbudarov added this to the 1.0.0 milestone Dec 1, 2020
@alexbudarov alexbudarov added the type: bug Something isn't working label Dec 1, 2020
@andreysubbotin andreysubbotin self-assigned this Dec 1, 2020
@knstvk knstvk modified the milestones: 0.9.0, 1.0.0 Mar 18, 2021
@knstvk knstvk changed the title We should cascade-delete RoleAssignmentEntity and other entities "owned" by User Cascade-delete RoleAssignmentEntity and other entities "owned" by User Mar 19, 2021
@knstvk knstvk changed the title Cascade-delete RoleAssignmentEntity and other entities "owned" by User Cascade-delete entities "owned" by User Mar 19, 2021
@andreysubbotin
Copy link
Contributor

andreysubbotin commented Apr 26, 2021

  • Introduce application eventUserRemovedEvent(UserDetails). The event is fired when a user is removed.
  • DatabaseUserRepository handles EntityChangedEvent for User entity and fires UserRemovedEvent
  • Custom security implementations can fire an UserRemovedEvent event according to their logic.
  • UI settings, table presentation, filters, role assignments subscribe to UserRemovedEvent and perform cleanup after a user was removed.

andreysubbotin pushed a commit to jmix-framework/jmix that referenced this issue May 7, 2021
andreysubbotin pushed a commit to jmix-framework/jmix that referenced this issue May 7, 2021
andreysubbotin pushed a commit to jmix-projects/jmix-rest that referenced this issue May 7, 2021
andreysubbotin added a commit to jmix-projects/jmix-ui that referenced this issue Jun 6, 2021
andreysubbotin added a commit to jmix-projects/jmix-ui that referenced this issue Jun 6, 2021
andreysubbotin added a commit that referenced this issue Jun 6, 2021
@andreysubbotin
Copy link
Contributor

The security problem that is described in the ticket description should be fixed.
Rows assotiated with user (column username) from tables sec_role_assignment_entity, ui_setting, ui_table_presentation, ui_filter_configuration` should be removed while remove user entity.

@maistrenkoIulia
Copy link

maistrenkoIulia commented Jun 16, 2021

1.1.0-SNAPSHOT - ok
Jmix version: 1.0.0-SNAPSHOT - ok

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants