With the help of Nate Sutton I’ve done two small refactorings to AuthSourceLdap#authenticate and #authenticate_dn. The Refactoring – One This refactoring moved the check for an empty DN into the #authenticate_dn method. It makes sense to have all of the business logic and data validations for authenticating in one method. Before 1 2 3 4 …
Tag: redmine
Daily Refactor #18: Extract method in AuthSourceLdap
The Refactoring AuthSourceLdap#authenticate still can use some more refactoring. I performed another extract method, this time to create a method to authenticate an DN (Distinguished Name). Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 # app/models/auth_source_ldap.rb class AuthSourceLdap self.base_dn, :filter …
Daily Refactor #17: Extract method in AuthSourceLdap
Since I’ve been doing a lot of work on a Redmine plugin to add more LDAP features, I decided to use today to refactor some of Redmine’s LDAP code. The Refactoring I just performed a simple extract method refactoring on the authenticate method in AuthSourceLdap to make it easier to understand what it does with …
Daily Refactor #16: Rename method in RolesController
The Refactoring I’m continuing last Friday’s refactor today, but this time renaming the method in RolesController. Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 # app/controllers/roles_controller.rb class RolesController :post, :only => [ :destroy, :move ], :redirect_to => { :action => :list } def index list …
Daily Refactor #15: Rename method in IssueStatusesController
It’s time to move on from the ReportsController to code that needs to be refactored more. Using Caliper’s Flay Report, it looks like IssueStatusesController, TrackersController, AuthSourcesController, and RolesController all have the exact same index action. 1 2 3 4 def index list render :action => 'list' unless request.xhr? end def index list render :action => …