mikeymicrophone / commissulator

Commissulator is a set of tools that help Real Estate Agents working with Citi Pads in Manhattan streamline their paperwork.
Other
3 stars 4 forks source link

Manage access to edit and delete links on employers #7

Open mikeymicrophone opened 5 years ago

mikeymicrophone commented 5 years ago

On the employers index, each employer is accompanied by links to edit or delete it. Refactor these so that they are generated by a single method that takes the employer as an argument.

The method should use cancancan to check whether the current_avatar has permission to edit the record before printing the edit link, and likewise for the delete link.

The icons that are used for edit and delete should not be hardcoded, but should be refactored into helpers called edit_icon and destroy_icon.

mikeymicrophone commented 5 years ago

The employers should be rendered with a helper in the same way that commissions and other resources are being done. Then, those other helpers should be updated to use the new method that provides them with access-managed edit and delete links.

The cancancan config in models/ability.rb should be updated so that non-admins can't destroy anything.

mikeymicrophone commented 5 years ago

Agents should have access to any deals they assist on. They should be able to view almost everything else. They should be able to edit assists on their deals until they are submitted.