usman 0.3.38 → 0.4.0.pre.materialize
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/app/controllers/usman/application_controller.rb +9 -1
 - data/app/controllers/usman/registrations_controller.rb +2 -2
 - data/app/controllers/usman/sessions_controller.rb +3 -3
 - data/app/controllers/usman/user_roles_controller.rb +1 -1
 - data/app/controllers/usman/users_controller.rb +1 -1
 - data/app/helpers/usman/authentication_helper.rb +16 -3
 - data/app/models/user.rb +76 -2
 - data/app/views/layouts/kuppayam/_sidebar.html.erb +6 -6
 - data/app/views/usman/dashboard/_index.html.erb +1 -1
 - data/app/views/usman/dashboard/_super_admin_index.html.erb +1 -1
 - data/app/views/usman/permissions/_index.html.erb +2 -2
 - data/app/views/usman/permissions/_row.html.erb +2 -2
 - data/app/views/usman/registration_devices/_index.html.erb +1 -1
 - data/app/views/usman/registration_devices/_row.html.erb +1 -1
 - data/app/views/usman/registrations/_index.html.erb +2 -2
 - data/app/views/usman/registrations/_row.html.erb +2 -2
 - data/app/views/usman/registrations/_show.html.erb +3 -3
 - data/app/views/usman/roles/_index.html.erb +2 -2
 - data/app/views/usman/roles/_row.html.erb +2 -2
 - data/app/views/usman/roles/_show.html.erb +2 -2
 - data/app/views/usman/user_roles/_index.html.erb +1 -1
 - data/app/views/usman/user_roles/_row.html.erb +1 -1
 - data/app/views/usman/users/_form.html.erb +1 -1
 - data/app/views/usman/users/_index.html.erb +2 -2
 - data/app/views/usman/users/_row.html.erb +2 -2
 - data/app/views/usman/users/_show.html.erb +8 -5
 - data/app/views/usman/users/index.html.erb +1 -1
 - data/db/data/dummy/users.csv +1 -1
 - data/db/data/users.csv +1 -1
 - data/db/migrate/20170000000100_create_users.rb +2 -1
 - data/lib/tasks/usman/data.rake +36 -2
 - data/lib/usman/version.rb +1 -1
 - data/spec/dummy/spec/factories/user.rb +3 -1
 - metadata +4 -4
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 249944b38740618e19948df32b3b5efb35c4d3c5bc40df91cd17f06804fc6b90
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 9f14a4c2d4903e35072317db1bf5a687f217ac39a645b22a01dcfd700fb7cce3
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: ed66807d187066a743ec189bc900ebb3861275e1e7bdcb0849ebd997f4e6f61aae77b4200cbcedd061daa0ef8ca51b8aab243789108f341423c2fb1402ba10ef
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: d2a1487af1403b6212739e49a9baf9b771582fdd4e7f3214de4784808f89499ad18ad26ff4e57b3f24170571284eee58d785e99732219c30a9dbcbaa2abd37b0
         
     | 
| 
         @@ -3,7 +3,7 @@ module Usman 
     | 
|
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
                include Usman::AuthenticationHelper
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
                layout 'kuppayam/admin'
         
     | 
| 
      
 6 
     | 
    
         
            +
                layout 'kuppayam/xenon/admin'
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
                before_action :current_user
         
     | 
| 
       9 
9 
     | 
    
         
             
                before_action :require_user
         
     | 
| 
         @@ -12,6 +12,14 @@ module Usman 
     | 
|
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
                private
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
      
 15 
     | 
    
         
            +
                def stylesheet_filename
         
     | 
| 
      
 16 
     | 
    
         
            +
                  @stylesheet_filename = "kuppayam-xenon"
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                def javascript_filename
         
     | 
| 
      
 20 
     | 
    
         
            +
                  @javascript_filename = "kuppayam-xenon"
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
                
         
     | 
| 
       15 
23 
     | 
    
         
             
                def set_default_title
         
     | 
| 
       16 
24 
     | 
    
         
             
                  set_title("Usman Admin | User Management Module")
         
     | 
| 
       17 
25 
     | 
    
         
             
                end
         
     | 
| 
         @@ -63,10 +63,10 @@ module Usman 
     | 
|
| 
       63 
63 
     | 
    
         
             
                def breadcrumbs_configuration
         
     | 
| 
       64 
64 
     | 
    
         
             
                  {
         
     | 
| 
       65 
65 
     | 
    
         
             
                    heading: "Manage Registrations",
         
     | 
| 
       66 
     | 
    
         
            -
                    icon: " 
     | 
| 
      
 66 
     | 
    
         
            +
                    icon: "fa-mobile",
         
     | 
| 
       67 
67 
     | 
    
         
             
                    description: "Listing all Registrations",
         
     | 
| 
       68 
68 
     | 
    
         
             
                    links: [{name: "Home", link: breadcrumb_home_path, icon: 'fa-home'}, 
         
     | 
| 
       69 
     | 
    
         
            -
                              {name: "Manage Registrations", link: registrations_path, icon: ' 
     | 
| 
      
 69 
     | 
    
         
            +
                              {name: "Manage Registrations", link: registrations_path, icon: 'fa-mobile', active: true}]
         
     | 
| 
       70 
70 
     | 
    
         
             
                  }
         
     | 
| 
       71 
71 
     | 
    
         
             
                end
         
     | 
| 
       72 
72 
     | 
    
         | 
| 
         @@ -3,7 +3,7 @@ module Usman 
     | 
|
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
                include Usman::AuthenticationHelper
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
                layout 'kuppayam/blank'
         
     | 
| 
      
 6 
     | 
    
         
            +
                layout 'kuppayam/xenon/blank'
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
                rescue_from ActionController::InvalidAuthenticityToken, :with => :rescue_from_invalid_authenticity_token
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
         @@ -90,11 +90,11 @@ module Usman 
     | 
|
| 
       90 
90 
     | 
    
         
             
                end
         
     | 
| 
       91 
91 
     | 
    
         | 
| 
       92 
92 
     | 
    
         
             
                def stylesheet_filename
         
     | 
| 
       93 
     | 
    
         
            -
                  @stylesheet_filename = "kuppayam"
         
     | 
| 
      
 93 
     | 
    
         
            +
                  @stylesheet_filename = "kuppayam-xenon"
         
     | 
| 
       94 
94 
     | 
    
         
             
                end
         
     | 
| 
       95 
95 
     | 
    
         | 
| 
       96 
96 
     | 
    
         
             
                def javascript_filename
         
     | 
| 
       97 
     | 
    
         
            -
                  @javascript_filename = "kuppayam"
         
     | 
| 
      
 97 
     | 
    
         
            +
                  @javascript_filename = "kuppayam-xenon"
         
     | 
| 
       98 
98 
     | 
    
         
             
                end
         
     | 
| 
       99 
99 
     | 
    
         | 
| 
       100 
100 
     | 
    
         
             
              end
         
     | 
| 
         @@ -136,7 +136,7 @@ module Usman 
     | 
|
| 
       136 
136 
     | 
    
         
             
                end
         
     | 
| 
       137 
137 
     | 
    
         | 
| 
       138 
138 
     | 
    
         
             
                def permitted_params
         
     | 
| 
       139 
     | 
    
         
            -
                  params.require(:user).permit(:name, :username, :email, : 
     | 
| 
      
 139 
     | 
    
         
            +
                  params.require(:user).permit(:name, :username, :email, :designation_name, :phone, :password, :password_confirmation)
         
     | 
| 
       140 
140 
     | 
    
         
             
                end
         
     | 
| 
       141 
141 
     | 
    
         | 
| 
       142 
142 
     | 
    
         
             
                def set_navs
         
     | 
| 
         @@ -15,7 +15,7 @@ module Usman 
     | 
|
| 
       15 
15 
     | 
    
         
             
                end
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                def permission_denied
         
     | 
| 
       18 
     | 
    
         
            -
                  render :file => "layouts/kuppayam/401", layout: 'layouts/kuppayam/blank_with_nav', :status => :unauthorized
         
     | 
| 
      
 18 
     | 
    
         
            +
                  render :file => "layouts/kuppayam/xenon/401", layout: 'layouts/kuppayam/xenon/blank_with_nav', :status => :unauthorized
         
     | 
| 
       19 
19 
     | 
    
         
             
                end
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
                # Returns the default URL to which the system should redirect the user after successful authentication
         
     | 
| 
         @@ -116,6 +116,19 @@ module Usman 
     | 
|
| 
       116 
116 
     | 
    
         
             
                  end
         
     | 
| 
       117 
117 
     | 
    
         
             
                end
         
     | 
| 
       118 
118 
     | 
    
         | 
| 
      
 119 
     | 
    
         
            +
                def require_role
         
     | 
| 
      
 120 
     | 
    
         
            +
                  return true if @current_user && @current_user.super_admin?
         
     | 
| 
      
 121 
     | 
    
         
            +
                  unless @current_user && @current_user.roles.any?
         
     | 
| 
      
 122 
     | 
    
         
            +
                    respond_to do |format|
         
     | 
| 
      
 123 
     | 
    
         
            +
                      format.html { permission_denied }
         
     | 
| 
      
 124 
     | 
    
         
            +
                      format.js {
         
     | 
| 
      
 125 
     | 
    
         
            +
                        set_params_hsh
         
     | 
| 
      
 126 
     | 
    
         
            +
                        render(:partial => 'usman/sessions/sign_in.js.erb', :handlers => [:erb], :formats => [:js])
         
     | 
| 
      
 127 
     | 
    
         
            +
                      }
         
     | 
| 
      
 128 
     | 
    
         
            +
                    end
         
     | 
| 
      
 129 
     | 
    
         
            +
                  end
         
     | 
| 
      
 130 
     | 
    
         
            +
                end
         
     | 
| 
      
 131 
     | 
    
         
            +
             
     | 
| 
       119 
132 
     | 
    
         
             
                def require_site_admin
         
     | 
| 
       120 
133 
     | 
    
         
             
                  return true if @current_user && @current_user.super_admin?
         
     | 
| 
       121 
134 
     | 
    
         
             
                  unless @current_user && @current_user.has_role?("Site Admin")
         
     | 
| 
         @@ -186,8 +199,8 @@ module Usman 
     | 
|
| 
       186 
199 
     | 
    
         
             
                end
         
     | 
| 
       187 
200 
     | 
    
         | 
| 
       188 
201 
     | 
    
         
             
                def current_permission
         
     | 
| 
       189 
     | 
    
         
            -
                   
     | 
| 
       190 
     | 
    
         
            -
                  @current_feature = Feature.published.find_by_name( 
     | 
| 
      
 202 
     | 
    
         
            +
                  feature_name = @resource_options[:feature_name] || @resource_options[:class]
         
     | 
| 
      
 203 
     | 
    
         
            +
                  @current_feature = Feature.published.find_by_name(feature_name)
         
     | 
| 
       191 
204 
     | 
    
         
             
                  feature_id = @current_feature ? @current_feature.id : -1
         
     | 
| 
       192 
205 
     | 
    
         
             
                  @current_permission = @current_user.permissions.where("feature_id = ?", feature_id).first
         
     | 
| 
       193 
206 
     | 
    
         
             
                end
         
     | 
    
        data/app/models/user.rb
    CHANGED
    
    | 
         @@ -95,7 +95,9 @@ class User < Usman::ApplicationRecord 
     | 
|
| 
       95 
95 
     | 
    
         
             
              scope :search, lambda {|query| where("LOWER(users.name) LIKE LOWER('%#{query}%') OR\
         
     | 
| 
       96 
96 
     | 
    
         
             
                                                    LOWER(users.username) LIKE LOWER('%#{query}%') OR\
         
     | 
| 
       97 
97 
     | 
    
         
             
                                                    LOWER(users.email) LIKE LOWER('%#{query}%') OR\
         
     | 
| 
       98 
     | 
    
         
            -
                                                    LOWER(users. 
     | 
| 
      
 98 
     | 
    
         
            +
                                                    LOWER(users.phone) LIKE LOWER('%#{query}%') OR\
         
     | 
| 
      
 99 
     | 
    
         
            +
                                                    LOWER(users.designation_name) LIKE LOWER('%#{query}%') OR\
         
     | 
| 
      
 100 
     | 
    
         
            +
                                                    LOWER(users.organisation_name) LIKE LOWER('%#{query}%')")
         
     | 
| 
       99 
101 
     | 
    
         
             
                                    }
         
     | 
| 
       100 
102 
     | 
    
         | 
| 
       101 
103 
     | 
    
         
             
              scope :status, lambda { |status| where("LOWER(status)='#{status}'") }
         
     | 
| 
         @@ -121,7 +123,8 @@ class User < Usman::ApplicationRecord 
     | 
|
| 
       121 
123 
     | 
    
         
             
                user = User.find_by_username(hsh[:username]) || User.new
         
     | 
| 
       122 
124 
     | 
    
         
             
                user.name = hsh[:name]
         
     | 
| 
       123 
125 
     | 
    
         
             
                user.username = hsh[:username]
         
     | 
| 
       124 
     | 
    
         
            -
                user. 
     | 
| 
      
 126 
     | 
    
         
            +
                user.designation_name = hsh[:designation_name]
         
     | 
| 
      
 127 
     | 
    
         
            +
                user.organisation_name = hsh[:organisation_name]
         
     | 
| 
       125 
128 
     | 
    
         
             
                user.email = hsh[:email]
         
     | 
| 
       126 
129 
     | 
    
         
             
                user.phone = hsh[:phone]
         
     | 
| 
       127 
130 
     | 
    
         | 
| 
         @@ -150,6 +153,77 @@ class User < Usman::ApplicationRecord 
     | 
|
| 
       150 
153 
     | 
    
         
             
                return error_object
         
     | 
| 
       151 
154 
     | 
    
         
             
              end
         
     | 
| 
       152 
155 
     | 
    
         | 
| 
      
 156 
     | 
    
         
            +
              def self.save_role_data(hsh)
         
     | 
| 
      
 157 
     | 
    
         
            +
             
     | 
| 
      
 158 
     | 
    
         
            +
                # Initializing error hash for displaying all errors altogether
         
     | 
| 
      
 159 
     | 
    
         
            +
                error_object = Kuppayam::Importer::ErrorHash.new
         
     | 
| 
      
 160 
     | 
    
         
            +
             
     | 
| 
      
 161 
     | 
    
         
            +
                return if hsh[:user].blank? || hsh[:role].blank?
         
     | 
| 
      
 162 
     | 
    
         
            +
             
     | 
| 
      
 163 
     | 
    
         
            +
                user = User.find_by_username(hsh[:user])
         
     | 
| 
      
 164 
     | 
    
         
            +
                role = Role.find_by_name(hsh[:role])
         
     | 
| 
      
 165 
     | 
    
         
            +
             
     | 
| 
      
 166 
     | 
    
         
            +
                return if user.blank? || role.blank?
         
     | 
| 
      
 167 
     | 
    
         
            +
             
     | 
| 
      
 168 
     | 
    
         
            +
                begin
         
     | 
| 
      
 169 
     | 
    
         
            +
                  user.add_role(role)
         
     | 
| 
      
 170 
     | 
    
         
            +
                rescue Exception => e
         
     | 
| 
      
 171 
     | 
    
         
            +
                  summary = "uncaught #{e} exception while handling connection: #{e.message}"
         
     | 
| 
      
 172 
     | 
    
         
            +
                  details = "Stack trace: #{e.backtrace.map {|l| "  #{l}\n"}.join}"
         
     | 
| 
      
 173 
     | 
    
         
            +
                  error_object.errors << { summary: summary, details: details }        
         
     | 
| 
      
 174 
     | 
    
         
            +
                end
         
     | 
| 
      
 175 
     | 
    
         
            +
                
         
     | 
| 
      
 176 
     | 
    
         
            +
                return error_object
         
     | 
| 
      
 177 
     | 
    
         
            +
              end
         
     | 
| 
      
 178 
     | 
    
         
            +
             
     | 
| 
      
 179 
     | 
    
         
            +
              def self.import_roles_data_file(csv_path, single_transaction=true, verbose=true)
         
     | 
| 
      
 180 
     | 
    
         
            +
                print_memory_usage do
         
     | 
| 
      
 181 
     | 
    
         
            +
                  print_time_spent do
         
     | 
| 
      
 182 
     | 
    
         
            +
                    if File.exists?(csv_path)
         
     | 
| 
      
 183 
     | 
    
         
            +
                      if File.extname(csv_path) == ".csv"
         
     | 
| 
      
 184 
     | 
    
         
            +
                        puts "CSV file found at '#{csv_path.to_s}'.".green if verbose
         
     | 
| 
      
 185 
     | 
    
         
            +
                        
         
     | 
| 
      
 186 
     | 
    
         
            +
                        errors = []
         
     | 
| 
      
 187 
     | 
    
         
            +
                        sum = 0
         
     | 
| 
      
 188 
     | 
    
         
            +
             
     | 
| 
      
 189 
     | 
    
         
            +
                        # , encoding: 'windows-1251:utf-8', :row_sep => :auto
         
     | 
| 
      
 190 
     | 
    
         
            +
                        if single_transaction
         
     | 
| 
      
 191 
     | 
    
         
            +
                          ActiveRecord::Base.transaction do 
         
     | 
| 
      
 192 
     | 
    
         
            +
                            CSV.foreach(csv_path, headers: true, header_converters: :symbol, skip_blanks: true) do |row|
         
     | 
| 
      
 193 
     | 
    
         
            +
                              error_object = save_role_data(row)
         
     | 
| 
      
 194 
     | 
    
         
            +
                              errors << error_object if error_object
         
     | 
| 
      
 195 
     | 
    
         
            +
                              error_object.print_dot if error_object && verbose
         
     | 
| 
      
 196 
     | 
    
         
            +
                              sum += 1
         
     | 
| 
      
 197 
     | 
    
         
            +
                            end
         
     | 
| 
      
 198 
     | 
    
         
            +
                          end
         
     | 
| 
      
 199 
     | 
    
         
            +
                        else
         
     | 
| 
      
 200 
     | 
    
         
            +
                          CSV.foreach(csv_path, headers: true, header_converters: :symbol, skip_blanks: true) do |row|
         
     | 
| 
      
 201 
     | 
    
         
            +
                            error_object = save_role_data(row)
         
     | 
| 
      
 202 
     | 
    
         
            +
                            errors << error_object if error_object
         
     | 
| 
      
 203 
     | 
    
         
            +
                            error_object.print_dot if error_object && verbose
         
     | 
| 
      
 204 
     | 
    
         
            +
                            sum += 1
         
     | 
| 
      
 205 
     | 
    
         
            +
                          end
         
     | 
| 
      
 206 
     | 
    
         
            +
                        end
         
     | 
| 
      
 207 
     | 
    
         
            +
                        puts "\tScanned #{sum} rows".yellow
         
     | 
| 
      
 208 
     | 
    
         
            +
             
     | 
| 
      
 209 
     | 
    
         
            +
                        if verbose
         
     | 
| 
      
 210 
     | 
    
         
            +
                          puts ""
         
     | 
| 
      
 211 
     | 
    
         
            +
                          errors.each do |error_object|
         
     | 
| 
      
 212 
     | 
    
         
            +
                            error_object.print_all if error_object
         
     | 
| 
      
 213 
     | 
    
         
            +
                          end
         
     | 
| 
      
 214 
     | 
    
         
            +
                        end
         
     | 
| 
      
 215 
     | 
    
         
            +
             
     | 
| 
      
 216 
     | 
    
         
            +
                      else
         
     | 
| 
      
 217 
     | 
    
         
            +
                        puts "Unsupported File encountered'#{path.to_s}'.".red if verbose
         
     | 
| 
      
 218 
     | 
    
         
            +
                        return
         
     | 
| 
      
 219 
     | 
    
         
            +
                      end
         
     | 
| 
      
 220 
     | 
    
         
            +
                    else
         
     | 
| 
      
 221 
     | 
    
         
            +
                      puts "Import File not found at '#{path.to_s}'.".red if verbose
         
     | 
| 
      
 222 
     | 
    
         
            +
                    end
         
     | 
| 
      
 223 
     | 
    
         
            +
                  end
         
     | 
| 
      
 224 
     | 
    
         
            +
                end
         
     | 
| 
      
 225 
     | 
    
         
            +
              end
         
     | 
| 
      
 226 
     | 
    
         
            +
             
     | 
| 
       153 
227 
     | 
    
         
             
              # ------------------
         
     | 
| 
       154 
228 
     | 
    
         
             
              # Instance Methods
         
     | 
| 
       155 
229 
     | 
    
         
             
              # ------------------
         
     | 
| 
         @@ -14,7 +14,7 @@ 
     | 
|
| 
       14 
14 
     | 
    
         
             
            		},
         
     | 
| 
       15 
15 
     | 
    
         
             
            		roles: {
         
     | 
| 
       16 
16 
     | 
    
         
             
            			text: "Manage Roles",
         
     | 
| 
       17 
     | 
    
         
            -
            			icon_class: " 
     | 
| 
      
 17 
     | 
    
         
            +
            			icon_class: "fa-graduation-cap",
         
     | 
| 
       18 
18 
     | 
    
         
             
            			url: usman.roles_url,
         
     | 
| 
       19 
19 
     | 
    
         
             
            			has_permission: @current_user.has_read_permission?(Role)
         
     | 
| 
       20 
20 
     | 
    
         
             
            		},
         
     | 
| 
         @@ -30,7 +30,7 @@ 
     | 
|
| 
       30 
30 
     | 
    
         
             
            	configuration_items = {
         
     | 
| 
       31 
31 
     | 
    
         
             
            		features: {
         
     | 
| 
       32 
32 
     | 
    
         
             
            			text: "Manage Features",
         
     | 
| 
       33 
     | 
    
         
            -
            			icon_class: " 
     | 
| 
      
 33 
     | 
    
         
            +
            			icon_class: "fa-diamond",
         
     | 
| 
       34 
34 
     | 
    
         
             
            			url: usman.features_url,
         
     | 
| 
       35 
35 
     | 
    
         
             
            			has_permission: @current_user.has_read_permission?(Feature)
         
     | 
| 
       36 
36 
     | 
    
         
             
            		}
         
     | 
| 
         @@ -93,11 +93,11 @@ 
     | 
|
| 
       93 
93 
     | 
    
         
             
            			<!-- Admin Dashboard -->
         
     | 
| 
       94 
94 
     | 
    
         
             
            			<% if @current_user.super_admin? || @current_user.has_role?("Site Admin") %>
         
     | 
| 
       95 
95 
     | 
    
         
             
            				<li class="<%= nav_active?('admin/dashboard') ? 'active' : ''  %>">
         
     | 
| 
       96 
     | 
    
         
            -
            					<%= link_to raw("<i class=\" 
     | 
| 
      
 96 
     | 
    
         
            +
            					<%= link_to raw("<i class=\"fa-desktop\"></i> <span class='title'>Dashboard</span>"), usman.dashboard_path %>
         
     | 
| 
       97 
97 
     | 
    
         
             
            				</li>
         
     | 
| 
       98 
98 
     | 
    
         
             
            			<% else %>
         
     | 
| 
       99 
99 
     | 
    
         
             
            				<li class="<%= nav_active?('profile/dashboard') ? 'active' : ''  %>">
         
     | 
| 
       100 
     | 
    
         
            -
            					<%= link_to raw("<i class=\" 
     | 
| 
      
 100 
     | 
    
         
            +
            					<%= link_to raw("<i class=\"fa-desktop\"></i> <span class='title'>Dashboard</span>"), usman.my_account_url %>
         
     | 
| 
       101 
101 
     | 
    
         
             
            				</li>
         
     | 
| 
       102 
102 
     | 
    
         
             
            			<% end %>
         
     | 
| 
       103 
103 
     | 
    
         | 
| 
         @@ -147,10 +147,10 @@ 
     | 
|
| 
       147 
147 
     | 
    
         
             
            			</li>
         
     | 
| 
       148 
148 
     | 
    
         | 
| 
       149 
149 
     | 
    
         
             
            			<li class="<%= nav_active?('profile/profile') ? 'active' : ''  %>">
         
     | 
| 
       150 
     | 
    
         
            -
            				<a href="#"><i class=" 
     | 
| 
      
 150 
     | 
    
         
            +
            				<a href="#"><i class="fa-user"></i><span class="title">My Account</span></a>
         
     | 
| 
       151 
151 
     | 
    
         
             
            				<ul>
         
     | 
| 
       152 
152 
     | 
    
         
             
            					<li class="<%= nav_class("profile/settings") %>">
         
     | 
| 
       153 
     | 
    
         
            -
            				    <%= link_to raw("<i class=\" 
     | 
| 
      
 153 
     | 
    
         
            +
            				    <%= link_to raw("<i class=\"fa-cog\"></i> <span class='title'>User Settings</span>"), "#" %>
         
     | 
| 
       154 
154 
     | 
    
         
             
            				  </li>
         
     | 
| 
       155 
155 
     | 
    
         
             
            				</ul>
         
     | 
| 
       156 
156 
     | 
    
         
             
            			</li>
         
     | 
| 
         @@ -36,9 +36,9 @@ 
     | 
|
| 
       36 
36 
     | 
    
         
             
            					<% if display_manage_links? %>
         
     | 
| 
       37 
37 
     | 
    
         
             
            			    <td class="action-links1" style="width:10%;text-align: center;">
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
            					  <%= link_to raw("<i class=\" 
     | 
| 
      
 39 
     | 
    
         
            +
            					  <%= link_to raw("<i class=\"fa-pencil\"></i>"), edit_link, :remote=>true, class: "edit" if display_edit_links? %>
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
       41 
     | 
    
         
            -
            					  <%= link_to raw("<i class=\" 
     | 
| 
      
 41 
     | 
    
         
            +
            					  <%= link_to raw("<i class=\"fa-trash\"></i>"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" if display_delete_links? %>
         
     | 
| 
       42 
42 
     | 
    
         | 
| 
       43 
43 
     | 
    
         
             
            					</td>
         
     | 
| 
       44 
44 
     | 
    
         
             
            					<% end %>
         
     | 
| 
         @@ -18,9 +18,9 @@ 
     | 
|
| 
       18 
18 
     | 
    
         
             
              <% if display_manage_links? %>
         
     | 
| 
       19 
19 
     | 
    
         
             
              <td class="action-links1" style="width:10%;text-align: center;">
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
                <%= link_to raw("<i class=\" 
     | 
| 
      
 21 
     | 
    
         
            +
                <%= link_to raw("<i class=\"fa-pencil\"></i>"), edit_link, :remote=>true, class: "edit" if display_edit_links? %>
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
                <%= link_to raw("<i class=\" 
     | 
| 
      
 23 
     | 
    
         
            +
                <%= link_to raw("<i class=\"fa-trash\"></i>"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" if display_delete_links? %>
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
              </td>
         
     | 
| 
       26 
26 
     | 
    
         
             
              <% end %>
         
     | 
| 
         @@ -44,7 +44,7 @@ 
     | 
|
| 
       44 
44 
     | 
    
         
             
            					<% delete_link = registration_device_path(@registration, device) %>
         
     | 
| 
       45 
45 
     | 
    
         
             
            					<td class="action-links" style="width:10%">
         
     | 
| 
       46 
46 
     | 
    
         | 
| 
       47 
     | 
    
         
            -
            		      	<%= link_to raw("<i class=\" 
     | 
| 
      
 47 
     | 
    
         
            +
            		      	<%= link_to raw("<i class=\"fa-trash\"></i> Remove Role"), delete_link, method: :delete, device: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" %>
         
     | 
| 
       48 
48 
     | 
    
         | 
| 
       49 
49 
     | 
    
         
             
            		      </td>
         
     | 
| 
       50 
50 
     | 
    
         
             
            		      <% end %>
         
     | 
| 
         @@ -26,7 +26,7 @@ 
     | 
|
| 
       26 
26 
     | 
    
         
             
              <% delete_link = registration_device_path(@registration, device) %>
         
     | 
| 
       27 
27 
     | 
    
         
             
              <td class="action-links" style="width:10%"> -->
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
                <%= link_to raw("<i class=\" 
     | 
| 
      
 29 
     | 
    
         
            +
                <%= link_to raw("<i class=\"fa-trash\"></i> Remove Role"), delete_link, method: :delete, device: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" %>
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
       31 
31 
     | 
    
         
             
              </td>
         
     | 
| 
       32 
32 
     | 
    
         
             
              <% end %>
         
     | 
| 
         @@ -63,9 +63,9 @@ 
     | 
|
| 
       63 
63 
     | 
    
         
             
            					<% delete_link = registration_path(id: registration.id) %>
         
     | 
| 
       64 
64 
     | 
    
         | 
| 
       65 
65 
     | 
    
         
             
            					<td class="action-links" style="width:10%">
         
     | 
| 
       66 
     | 
    
         
            -
            		      	<%#= link_to raw("<i class=\" 
     | 
| 
      
 66 
     | 
    
         
            +
            		      	<%#= link_to raw("<i class=\"fa-pencil\"></i> Edit Registration"), edit_link, :remote=>true, class: "edit" if registration.can_be_edited? and display_edit_links? %>
         
     | 
| 
       67 
67 
     | 
    
         | 
| 
       68 
     | 
    
         
            -
            		        <%= link_to raw("<i class=\" 
     | 
| 
      
 68 
     | 
    
         
            +
            		        <%= link_to raw("<i class=\"fa-trash\"></i> Delete"), delete_link, method: :delete, registration: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" if registration.can_be_deleted? and display_delete_links? %>
         
     | 
| 
       69 
69 
     | 
    
         
             
            		      </td>
         
     | 
| 
       70 
70 
     | 
    
         
             
            		      <% end %>
         
     | 
| 
       71 
71 
     | 
    
         | 
| 
         @@ -45,9 +45,9 @@ 
     | 
|
| 
       45 
45 
     | 
    
         
             
              <% delete_link = registration_path(id: registration.id) %>
         
     | 
| 
       46 
46 
     | 
    
         | 
| 
       47 
47 
     | 
    
         
             
              <td class="action-links" style="width:10%">
         
     | 
| 
       48 
     | 
    
         
            -
                <%#= link_to raw("<i class=\" 
     | 
| 
      
 48 
     | 
    
         
            +
                <%#= link_to raw("<i class=\"fa-pencil\"></i> Edit Registration"), edit_link, :remote=>true, class: "edit" if registration.can_be_edited? and display_edit_links? %>
         
     | 
| 
       49 
49 
     | 
    
         | 
| 
       50 
     | 
    
         
            -
                <%= link_to raw("<i class=\" 
     | 
| 
      
 50 
     | 
    
         
            +
                <%= link_to raw("<i class=\"fa-trash\"></i> Delete"), delete_link, method: :delete, registration: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" if registration.can_be_deleted? and display_delete_links? %>
         
     | 
| 
       51 
51 
     | 
    
         
             
              </td>
         
     | 
| 
       52 
52 
     | 
    
         
             
              <% end %>
         
     | 
| 
       53 
53 
     | 
    
         | 
| 
         @@ -55,9 +55,9 @@ 
     | 
|
| 
       55 
55 
     | 
    
         
             
            	  	<%# edit_link = edit_registration_path(id: @registration.id) %>
         
     | 
| 
       56 
56 
     | 
    
         
             
            			<%# delete_link = registration_path(id: @registration.id) %>
         
     | 
| 
       57 
57 
     | 
    
         | 
| 
       58 
     | 
    
         
            -
            			<%#= link_to raw("<i class=\" 
     | 
| 
      
 58 
     | 
    
         
            +
            			<%#= link_to raw("<i class=\"fa-pencil\"></i> Edit Registration"), edit_link, :remote=>true, class: "btn btn-block btn-success" if @current_device.super_admin? and @registration.can_be_edited? %>
         
     | 
| 
       59 
59 
     | 
    
         | 
| 
       60 
     | 
    
         
            -
            	    <%#= link_to raw("<i class=\" 
     | 
| 
      
 60 
     | 
    
         
            +
            	    <%#= link_to raw("<i class=\"fa-trash\"></i> Delete Registration"), delete_link, method: :delete, registration: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "btn btn-block btn-danger btn-only-hover" if @current_device.super_admin? and @registration.can_be_deleted? %>
         
     | 
| 
       61 
61 
     | 
    
         | 
| 
       62 
62 
     | 
    
         
             
            	    <div class="visible-sm visible-xs mb-50"></div>
         
     | 
| 
       63 
63 
     | 
    
         | 
| 
         @@ -165,7 +165,7 @@ 
     | 
|
| 
       165 
165 
     | 
    
         
             
            						</tr>
         
     | 
| 
       166 
166 
     | 
    
         | 
| 
       167 
167 
     | 
    
         
             
            						<tr>
         
     | 
| 
       168 
     | 
    
         
            -
            							<th>Designation</th><td><%= @user.try(: 
     | 
| 
      
 168 
     | 
    
         
            +
            							<th>Designation</th><td><%= @user.try(:designation_name) %></td>
         
     | 
| 
       169 
169 
     | 
    
         
             
            							<th>Status</th><td>
         
     | 
| 
       170 
170 
     | 
    
         
             
            								<% if @user.pending? %>
         
     | 
| 
       171 
171 
     | 
    
         
             
            									<span class="label label-default">Pending</span>
         
     | 
| 
         @@ -31,9 +31,9 @@ 
     | 
|
| 
       31 
31 
     | 
    
         
             
            					<% if display_manage_links? %>
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
            				  <td class="action-links hidden-xs hidden-sm" style="width:10%">
         
     | 
| 
       34 
     | 
    
         
            -
            				    <%= link_to raw("<i class=\" 
     | 
| 
      
 34 
     | 
    
         
            +
            				    <%= link_to raw("<i class=\"fa-pencil\"></i> Edit Role"), edit_link, :remote=>true, class: "edit" if role.can_be_edited? and display_edit_links? %>
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
            				    <%= link_to raw("<i class=\" 
     | 
| 
      
 36 
     | 
    
         
            +
            				    <%= link_to raw("<i class=\"fa-trash\"></i> Delete"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" if role.can_be_deleted? and display_delete_links? %>
         
     | 
| 
       37 
37 
     | 
    
         
             
            				  </td>
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
39 
     | 
    
         
             
            				  <% end %>
         
     | 
| 
         @@ -16,9 +16,9 @@ 
     | 
|
| 
       16 
16 
     | 
    
         
             
              <% if display_manage_links? %>
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
              <td class="action-links hidden-xs hidden-sm" style="width:10%">
         
     | 
| 
       19 
     | 
    
         
            -
                <%= link_to raw("<i class=\" 
     | 
| 
      
 19 
     | 
    
         
            +
                <%= link_to raw("<i class=\"fa-pencil\"></i> Edit Role"), edit_link, :remote=>true, class: "edit" if role.can_be_edited? and display_edit_links? %>
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
                <%= link_to raw("<i class=\" 
     | 
| 
      
 21 
     | 
    
         
            +
                <%= link_to raw("<i class=\"fa-trash\"></i> Delete"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" if role.can_be_deleted? and display_delete_links? %>
         
     | 
| 
       22 
22 
     | 
    
         
             
              </td>
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
24 
     | 
    
         
             
              <% end %>
         
     | 
| 
         @@ -23,9 +23,9 @@ 
     | 
|
| 
       23 
23 
     | 
    
         
             
            	  	<% edit_link = edit_role_path(id: @role.id) %>
         
     | 
| 
       24 
24 
     | 
    
         
             
            			<% delete_link = role_path(id: @role.id) %>
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
            			<%= link_to raw("<i class=\" 
     | 
| 
      
 26 
     | 
    
         
            +
            			<%= link_to raw("<i class=\"fa-pencil\"></i> Edit Role"), edit_link, :remote=>true, class: "btn btn-block btn-success" if @current_user.super_admin? and @role.can_be_edited? and display_edit_links? %>
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
     | 
    
         
            -
            	    <%= link_to raw("<i class=\" 
     | 
| 
      
 28 
     | 
    
         
            +
            	    <%= link_to raw("<i class=\"fa-trash\"></i> Delete Role"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "btn btn-block btn-danger btn-only-hover" if @current_user.super_admin? and @role.can_be_deleted? and display_delete_links? %>
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
            	    <div class="visible-sm visible-xs mb-50"></div>
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
         @@ -45,7 +45,7 @@ 
     | 
|
| 
       45 
45 
     | 
    
         | 
| 
       46 
46 
     | 
    
         
             
            		      <td class="action-links" style="width:10%">
         
     | 
| 
       47 
47 
     | 
    
         | 
| 
       48 
     | 
    
         
            -
            		      	<%= link_to raw("<i class=\" 
     | 
| 
      
 48 
     | 
    
         
            +
            		      	<%= link_to raw("<i class=\"fa-trash\"></i> Remove Role"), delete_link, method: :delete, user: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" %>
         
     | 
| 
       49 
49 
     | 
    
         | 
| 
       50 
50 
     | 
    
         
             
            		      </td>
         
     | 
| 
       51 
51 
     | 
    
         | 
| 
         @@ -29,7 +29,7 @@ 
     | 
|
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
              <td class="action-links" style="width:10%">
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
                <%= link_to raw("<i class=\" 
     | 
| 
      
 32 
     | 
    
         
            +
                <%= link_to raw("<i class=\"fa-trash\"></i> Remove Role"), delete_link, method: :delete, user: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" %>
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         
             
              </td>
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
         @@ -11,7 +11,7 @@ 
     | 
|
| 
       11 
11 
     | 
    
         
             
                        <%= theme_form_field(@user, :name) %>
         
     | 
| 
       12 
12 
     | 
    
         
             
                        <%= theme_form_field(@user, :username) %>
         
     | 
| 
       13 
13 
     | 
    
         
             
                        <%= theme_form_field(@user, :email) %>
         
     | 
| 
       14 
     | 
    
         
            -
                        <%= theme_form_field(@user, : 
     | 
| 
      
 14 
     | 
    
         
            +
                        <%= theme_form_field(@user, :designation_name, required: false) %>
         
     | 
| 
       15 
15 
     | 
    
         
             
                      </div>
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                      <div class="col-md-6 col-xs-12">
         
     | 
| 
         @@ -68,9 +68,9 @@ 
     | 
|
| 
       68 
68 
     | 
    
         
             
            					<% if display_manage_links? %>
         
     | 
| 
       69 
69 
     | 
    
         
             
            				    <td class="action-links hidden-xs hidden-sm" style="width:15%">
         
     | 
| 
       70 
70 
     | 
    
         | 
| 
       71 
     | 
    
         
            -
            				      <%= link_to raw("<i class=\" 
     | 
| 
      
 71 
     | 
    
         
            +
            				      <%= link_to raw("<i class=\"fa-pencil\"></i> Edit User"), edit_link, :remote=>true, class: "edit" if user.can_be_edited? && display_edit_links? %>
         
     | 
| 
       72 
72 
     | 
    
         | 
| 
       73 
     | 
    
         
            -
            				      <%= link_to raw("<i class=\" 
     | 
| 
      
 73 
     | 
    
         
            +
            				      <%= link_to raw("<i class=\"fa-trash\"></i> Delete"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" if @current_user.super_admin? && user.can_be_deleted? && (@current_user != user) %>
         
     | 
| 
       74 
74 
     | 
    
         
             
            				    </td>
         
     | 
| 
       75 
75 
     | 
    
         
             
            				  <% end %>
         
     | 
| 
       76 
76 
     | 
    
         | 
| 
         @@ -52,9 +52,9 @@ 
     | 
|
| 
       52 
52 
     | 
    
         
             
              <% if display_manage_links? %>
         
     | 
| 
       53 
53 
     | 
    
         
             
                <td class="action-links hidden-xs hidden-sm" style="width:15%">
         
     | 
| 
       54 
54 
     | 
    
         | 
| 
       55 
     | 
    
         
            -
                  <%= link_to raw("<i class=\" 
     | 
| 
      
 55 
     | 
    
         
            +
                  <%= link_to raw("<i class=\"fa-pencil\"></i> Edit User"), edit_link, :remote=>true, class: "edit" if user.can_be_edited? && display_edit_links? %>
         
     | 
| 
       56 
56 
     | 
    
         | 
| 
       57 
     | 
    
         
            -
                  <%= link_to raw("<i class=\" 
     | 
| 
      
 57 
     | 
    
         
            +
                  <%= link_to raw("<i class=\"fa-trash\"></i> Delete"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" if @current_user.super_admin? && user.can_be_deleted? && (@current_user != user) %>
         
     | 
| 
       58 
58 
     | 
    
         
             
                </td>
         
     | 
| 
       59 
59 
     | 
    
         
             
              <% end %>
         
     | 
| 
       60 
60 
     | 
    
         | 
| 
         @@ -23,7 +23,7 @@ 
     | 
|
| 
       23 
23 
     | 
    
         
             
            	  	<div class="visible-sm visible-xs mt-50"></div>
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
            	  	<%= theme_panel_heading(@user.name) %>
         
     | 
| 
       26 
     | 
    
         
            -
            	    <%= theme_panel_sub_heading(@user. 
     | 
| 
      
 26 
     | 
    
         
            +
            	    <%= theme_panel_sub_heading(@user.designation_name, "#") if @user.designation_name %>
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
28 
     | 
    
         
             
            	    <%= clear_tag(10) %>
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
         @@ -51,13 +51,13 @@ 
     | 
|
| 
       51 
51 
     | 
    
         
             
            	  	<% edit_link = edit_user_path(id: @user.id) %>
         
     | 
| 
       52 
52 
     | 
    
         
             
            			<% delete_link = user_path(id: @user.id) %>
         
     | 
| 
       53 
53 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
            			<%= link_to raw("<i class=\" 
     | 
| 
      
 54 
     | 
    
         
            +
            			<%= link_to raw("<i class=\"fa-pencil\"></i> Edit User"), edit_link, :remote=>true, class: "btn btn-block btn-success" if @user.can_be_edited? %>
         
     | 
| 
       55 
55 
     | 
    
         | 
| 
       56 
     | 
    
         
            -
            	    <%= link_to raw("<i class=\" 
     | 
| 
      
 56 
     | 
    
         
            +
            	    <%= link_to raw("<i class=\"fa-trash\"></i> Delete"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "btn btn-block btn-danger btn-only-hover" if @user.can_be_deleted? && (@current_user != @user) && @current_permission && @current_permission.can_delete? %>
         
     | 
| 
       57 
57 
     | 
    
         | 
| 
       58 
58 
     | 
    
         
             
            	    <% if @current_user.super_admin? %>
         
     | 
| 
       59 
59 
     | 
    
         | 
| 
       60 
     | 
    
         
            -
            	      <%= link_to raw("<i class=\" 
     | 
| 
      
 60 
     | 
    
         
            +
            	      <%= link_to raw("<i class=\"fa-badge-check\"></i> Masquerade"), masquerade_user_path(@user), method: :put, data: { confirm: "Are you sure? Do you really want to logout current session and login as #{@user.name}?" }, class: "btn btn-block btn-gray btn-only-hover" if @current_user != @user %>
         
     | 
| 
       61 
61 
     | 
    
         | 
| 
       62 
62 
     | 
    
         
             
            	      <!-- Remove Super Admin -->
         
     | 
| 
       63 
63 
     | 
    
         
             
            		    <%= link_to raw("<i class=\"fa fa-remove mr-5\"></i> Remove Super Admin"), remove_super_admin_user_path(id: @user.id), method: :put, :remote=>true, role: "menuitem", tabindex: "-1", :class=>"btn btn-block btn-danger btn-only-hover" if @user.super_admin? && (@current_user != @user) %>
         
     | 
| 
         @@ -102,7 +102,9 @@ 
     | 
|
| 
       102 
102 
     | 
    
         
             
            				<tr><th>Gender</th><td><%= @user.gender %></td></tr>
         
     | 
| 
       103 
103 
     | 
    
         
             
            				<tr><th>Date of Birth</th><td><%= @user.date_of_birth.strftime("%m/%d/%Y") if @user.date_of_birth %></td></tr>
         
     | 
| 
       104 
104 
     | 
    
         | 
| 
       105 
     | 
    
         
            -
            				<tr><th>Designation</th><td><%= @user. 
     | 
| 
      
 105 
     | 
    
         
            +
            				<tr><th>Designation</th><td><%= @user.designation_name %></td></tr>
         
     | 
| 
      
 106 
     | 
    
         
            +
            				<tr><th>Organisation</th><td><%= @user.organisation_name %></td></tr>
         
     | 
| 
      
 107 
     | 
    
         
            +
             
     | 
| 
       106 
108 
     | 
    
         
             
            				<tr><th>Status</th><td>
         
     | 
| 
       107 
109 
     | 
    
         
             
            						<% if @user.pending? %>
         
     | 
| 
       108 
110 
     | 
    
         
             
            							<span class="label label-default">Pending</span>
         
     | 
| 
         @@ -113,6 +115,7 @@ 
     | 
|
| 
       113 
115 
     | 
    
         
             
            						<% end %>
         
     | 
| 
       114 
116 
     | 
    
         
             
            					</td>
         
     | 
| 
       115 
117 
     | 
    
         
             
            				</tr>
         
     | 
| 
      
 118 
     | 
    
         
            +
            				<tr><th></th><td></td></tr>
         
     | 
| 
       116 
119 
     | 
    
         | 
| 
       117 
120 
     | 
    
         
             
            				<% if @current_user.super_admin? %>
         
     | 
| 
       118 
121 
     | 
    
         
             
            				<tr><th>Dummy?</th><td><%= @user.dummy.to_s.titleize %></td></tr>
         
     | 
| 
         @@ -30,7 +30,7 @@ 
     | 
|
| 
       30 
30 
     | 
    
         | 
| 
       31 
31 
     | 
    
         
             
                          <%= theme_button('Refresh', 'refresh', users_path(sa: params[:sa]), classes: "pull-left mr-10", btn_type: "white") %>
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
                          <%= theme_button('Manage Roles', 'nothing  
     | 
| 
      
 33 
     | 
    
         
            +
                          <%= theme_button('Manage Roles', 'nothing fa-graduation-cap', roles_path(), classes: "pull-left mr-10", btn_type: "white", remote: false) if @current_user.has_create_permission?(Role) %>
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
35 
     | 
    
         
             
                          <!-- Single button -->
         
     | 
| 
       36 
36 
     | 
    
         
             
                          <div class="ml-10 btn-group hidden">
         
     | 
    
        data/db/data/dummy/users.csv
    CHANGED
    
    | 
         @@ -1,4 +1,4 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            name,username, 
     | 
| 
      
 1 
     | 
    
         
            +
            name,username,designation_name,email,phone,super_admin,status
         
     | 
| 
       2 
2 
     | 
    
         
             
            Krishna Prasad Varma,kpvarma,Site Admin,prasad@rightsolutions.io,,TRUE,approved
         
     | 
| 
       3 
3 
     | 
    
         
             
            Vinodh Ellath,vinodh,Site Admin,vinodh@rightsolutions.io,,TRUE,approved
         
     | 
| 
       4 
4 
     | 
    
         
             
            Junaid Ramzan,junaid.ramzan,Site Admin,junaid.ramzan@gmail.com,,TRUE,approved
         
     | 
    
        data/db/data/users.csv
    CHANGED
    
    | 
         @@ -1,4 +1,4 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            name,username, 
     | 
| 
      
 1 
     | 
    
         
            +
            name,username,designation_name,email,phone,super_admin,status
         
     | 
| 
       2 
2 
     | 
    
         
             
            Krishna Prasad Varma,kpvarma,Site Admin,prasad@rightsolutions.io,,TRUE,approved
         
     | 
| 
       3 
3 
     | 
    
         
             
            Vinodh Ellath,vinodh,Site Admin,vinodh@rightsolutions.io,,TRUE,approved
         
     | 
| 
       4 
4 
     | 
    
         
             
            Junaid Ramzan,junaid.ramzan,Site Admin,junaid.ramzan@gmail.com,,TRUE,approved
         
     | 
| 
         @@ -7,7 +7,8 @@ class CreateUsers < ActiveRecord::Migration[5.0] 
     | 
|
| 
       7 
7 
     | 
    
         
             
                  t.string :username, :null => false, :limit=>32
         
     | 
| 
       8 
8 
     | 
    
         
             
                  t.string :email, :null => false
         
     | 
| 
       9 
9 
     | 
    
         
             
                  t.string :phone, :null => true, :limit=>24
         
     | 
| 
       10 
     | 
    
         
            -
                  t.string : 
     | 
| 
      
 10 
     | 
    
         
            +
                  t.string :designation_name, :null => true, :limit=>56
         
     | 
| 
      
 11 
     | 
    
         
            +
                  t.string :organisation_name, :null => true, :limit=>56
         
     | 
| 
       11 
12 
     | 
    
         | 
| 
       12 
13 
     | 
    
         
             
                  t.boolean :super_admin, :null => true, default: false
         
     | 
| 
       13 
14 
     | 
    
         | 
    
        data/lib/tasks/usman/data.rake
    CHANGED
    
    | 
         @@ -9,7 +9,7 @@ namespace 'usman' do 
     | 
|
| 
       9 
9 
     | 
    
         
             
                  desc "Import all data in sequence"
         
     | 
| 
       10 
10 
     | 
    
         
             
                  task 'all' => :environment do
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
                    import_list = ["users", "permissions"]
         
     | 
| 
      
 12 
     | 
    
         
            +
                    import_list = ["users", "permissions", "users_roles"]
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
                    import_list.each do |item|
         
     | 
| 
       15 
15 
     | 
    
         
             
                      print "Importing #{item.titleize} \t".yellow
         
     | 
| 
         @@ -44,12 +44,29 @@ namespace 'usman' do 
     | 
|
| 
       44 
44 
     | 
    
         
             
                    end
         
     | 
| 
       45 
45 
     | 
    
         
             
                  end
         
     | 
| 
       46 
46 
     | 
    
         | 
| 
      
 47 
     | 
    
         
            +
                  desc "Import Users Roles"
         
     | 
| 
      
 48 
     | 
    
         
            +
                  task :users_roles => :environment do
         
     | 
| 
      
 49 
     | 
    
         
            +
                    verbose = true
         
     | 
| 
      
 50 
     | 
    
         
            +
                    verbose = false if ["false", "f","0","no","n"].include?(ENV["verbose"].to_s.downcase.strip)
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                    destroy_all = false
         
     | 
| 
      
 53 
     | 
    
         
            +
                    destroy_all = true if ["true", "t","1","yes","y"].include?(ENV["destroy_all"].to_s.downcase.strip)
         
     | 
| 
      
 54 
     | 
    
         
            +
                    
         
     | 
| 
      
 55 
     | 
    
         
            +
                    path = Rails.root.join('db', 'data', "users_roles.csv")
         
     | 
| 
      
 56 
     | 
    
         
            +
                    path = Usman::Engine.root.join('db', 'data', "users_roles.csv") unless File.exists?(path)
         
     | 
| 
      
 57 
     | 
    
         
            +
                    
         
     | 
| 
      
 58 
     | 
    
         
            +
                    # FIXME - Don't know how to clean up a HABTM intermediate table contents
         
     | 
| 
      
 59 
     | 
    
         
            +
                    # cls_name.constantize.destroy_all if destroy_all
         
     | 
| 
      
 60 
     | 
    
         
            +
                    User.import_roles_data_file(path, true, verbose)
         
     | 
| 
      
 61 
     | 
    
         
            +
                    puts "Importing Completed".green if verbose
         
     | 
| 
      
 62 
     | 
    
         
            +
                  end
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
       47 
64 
     | 
    
         
             
                  namespace 'dummy' do
         
     | 
| 
       48 
65 
     | 
    
         | 
| 
       49 
66 
     | 
    
         
             
                    desc "Import all dummy data in sequence"
         
     | 
| 
       50 
67 
     | 
    
         
             
                    task 'all' => :environment do
         
     | 
| 
       51 
68 
     | 
    
         | 
| 
       52 
     | 
    
         
            -
                      import_list = ["users", "permissions"]
         
     | 
| 
      
 69 
     | 
    
         
            +
                      import_list = ["users", "permissions", "users_roles"]
         
     | 
| 
       53 
70 
     | 
    
         | 
| 
       54 
71 
     | 
    
         
             
                      import_list.each do |item|
         
     | 
| 
       55 
72 
     | 
    
         
             
                        print "Loading #{item.split(':').last.titleize} \t".yellow
         
     | 
| 
         @@ -83,6 +100,23 @@ namespace 'usman' do 
     | 
|
| 
       83 
100 
     | 
    
         
             
                        puts "Importing Completed".green if verbose
         
     | 
| 
       84 
101 
     | 
    
         
             
                      end
         
     | 
| 
       85 
102 
     | 
    
         
             
                    end
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
                    desc "Import Users Roles"
         
     | 
| 
      
 105 
     | 
    
         
            +
                    task :users_roles => :environment do
         
     | 
| 
      
 106 
     | 
    
         
            +
                      verbose = true
         
     | 
| 
      
 107 
     | 
    
         
            +
                      verbose = false if ["false", "f","0","no","n"].include?(ENV["verbose"].to_s.downcase.strip)
         
     | 
| 
      
 108 
     | 
    
         
            +
             
     | 
| 
      
 109 
     | 
    
         
            +
                      destroy_all = false
         
     | 
| 
      
 110 
     | 
    
         
            +
                      destroy_all = true if ["true", "t","1","yes","y"].include?(ENV["destroy_all"].to_s.downcase.strip)
         
     | 
| 
      
 111 
     | 
    
         
            +
                      
         
     | 
| 
      
 112 
     | 
    
         
            +
                      path = Rails.root.join('db', 'data', "users_roles.csv")
         
     | 
| 
      
 113 
     | 
    
         
            +
                      path = Usman::Engine.root.join('db', 'data', 'dummy', "users_roles.csv") unless File.exists?(path)
         
     | 
| 
      
 114 
     | 
    
         
            +
                      
         
     | 
| 
      
 115 
     | 
    
         
            +
                      # FIXME - Don't know how to clean up a HABTM intermediate table contents
         
     | 
| 
      
 116 
     | 
    
         
            +
                      # cls_name.constantize.destroy_all if destroy_all
         
     | 
| 
      
 117 
     | 
    
         
            +
                      User.import_roles_data_file(path, true, verbose)
         
     | 
| 
      
 118 
     | 
    
         
            +
                      puts "Importing Completed".green if verbose
         
     | 
| 
      
 119 
     | 
    
         
            +
                    end
         
     | 
| 
       86 
120 
     | 
    
         
             
                  end
         
     | 
| 
       87 
121 
     | 
    
         | 
| 
       88 
122 
     | 
    
         
             
                end
         
     | 
    
        data/lib/usman/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: usman
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.0.pre.materialize
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - kpvarma
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2018- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2018-03-28 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rails
         
     | 
| 
         @@ -644,9 +644,9 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       644 
644 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       645 
645 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       646 
646 
     | 
    
         
             
              requirements:
         
     | 
| 
       647 
     | 
    
         
            -
              - - " 
     | 
| 
      
 647 
     | 
    
         
            +
              - - ">"
         
     | 
| 
       648 
648 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       649 
     | 
    
         
            -
                  version:  
     | 
| 
      
 649 
     | 
    
         
            +
                  version: 1.3.1
         
     | 
| 
       650 
650 
     | 
    
         
             
            requirements: []
         
     | 
| 
       651 
651 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       652 
652 
     | 
    
         
             
            rubygems_version: 2.7.3
         
     |