Project

General

Profile

Feature #39373

Move save/delete logic from django models to middleware

Added by William Grzybowski about 1 year ago. Updated 7 months ago.

Status:
Done
Priority:
No priority
Assignee:
Vladimir Vinogradenko
Category:
Middleware
Target version:
Estimated time:
Severity:
Medium
Reason for Closing:
Reason for Blocked:
Needs QA:
No
Needs Doc:
No
Needs Merging:
No
Needs Automation:
No
Support Suite Ticket:
n/a
Hardware Configuration:

Description

While moving logic from legacy UI to middlewared we didnt take care of moving the delete logic from models to middlewared.
We need to move delete logic from account app models to respective middlewared plugins.

Risk
Medium risk, we may break deleting users/groups

Acceptance Criteria
Once this is done we should be able to delete all entities from account (users, groups).

History

#1 Updated by Vladimir Vinogradenko about 1 year ago

  • Status changed from Unscreened to Blocked
  • Reason for Blocked set to Waiting for feedback

Which logic? I see there is UserService.do_delete and Django bsdUsersForm.delete just calls user.delete

#2 Updated by William Grzybowski about 1 year ago

Vladimir Vinogradenko wrote:

Which logic? I see there is UserService.do_delete and Django bsdUsersForm.delete just calls user.delete

In the model, e.g.

    def delete(self, using=None, reload=True, delete_group=True):
        if self.bsdusr_builtin is True:
            raise ValueError(_(
                "User %s is built-in and can not be deleted!" 
            ) % (self.bsdusr_username))
        super(bsdUsers, self).delete(using)

We need a generic way for deletion of things from GUI to call middlewared delete, not delete things directly in database.

#3 Updated by William Grzybowski about 1 year ago

Users might not have been the best example I could pick, since it has a custom delete form ;).

#4 Updated by Vladimir Vinogradenko about 1 year ago

So users is just an example? We should do this for all plugins that have `delete`? (SMART, Cloud Sync, iSCSI, Dataset, NTP, etc...) And the scope of this issue is creating a generic method + applying it to all models?

#5 Updated by William Grzybowski about 1 year ago

Vladimir Vinogradenko wrote:

So users is just an example? We should do this for all plugins that have `delete`? (SMART, Cloud Sync, iSCSI, Dataset, NTP, etc...) And the scope of this issue is creating a generic method + applying it to all models?

I wanted to do it in steps. I was hoping for now we could handle account app (users, groups) with a generic method that can be use for all later on.

#6 Updated by Bug Clerk about 1 year ago

  • Status changed from Blocked to In Progress

#7 Updated by Bug Clerk about 1 year ago

  • Status changed from In Progress to Ready for Testing

#8 Updated by Dru Lavigne 11 months ago

  • Subject changed from Move django account app models delete logic to middlewared to Move save/delete logic from django models to middleware
  • Reason for Blocked deleted (Waiting for feedback)

#9 Updated by Dru Lavigne 9 months ago

  • Target version changed from 11.3 to 11.3-BETA1

#12 Updated by Bonnie Follweiler 8 months ago

  • Status changed from Ready for Testing to Passed Testing
  • Needs QA changed from Yes to No

Test Passed in FreeNAS-11.3-MASTER-201903011000

#13 Updated by Dru Lavigne 8 months ago

  • Status changed from Passed Testing to Done

#14 Updated by Dru Lavigne 7 months ago

  • Target version changed from 11.3-BETA1 to 11.3-ALPHA1

Also available in: Atom PDF