kadmin 1.0.7 → 1.0.8
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
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 6b77f3984bbb1305f00fd24d9e4f2ee58e5f816b4d46fe6f53ee4282e96182f1
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 9cc07fbdde13d24818c964979cf0a87a4a57a4db38bb1be2a7502d024a0f69c8
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: c6244cd45d2ad12cff9051a5fdb51c3052116944c4e5b2f5c2490ed4ec73e6a9f3d052705c0c1c05b494215c52a2f521f679374fdba6420a192bb9e5b0af15bf
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 5995dc8d92e23f4bb4447f03f9731ba8d8f74691eefbd67abea43d2d1c1b84222e8585640ec778db58e1f7092f3c8e8534c3d830d8d485567be74a3053b51b48
         
     | 
| 
         @@ -68,9 +68,16 @@ module Kadmin 
     | 
|
| 
       68 
68 
     | 
    
         
             
                end
         
     | 
| 
       69 
69 
     | 
    
         | 
| 
       70 
70 
     | 
    
         
             
                def organization
         
     | 
| 
       71 
     | 
    
         
            -
                  if authorized_user. 
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
      
 71 
     | 
    
         
            +
                  return @organization if authorized_user.blank?
         
     | 
| 
      
 72 
     | 
    
         
            +
                  return @organization if @organization.present?
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
                  if session[Kadmin::AuthController::SESSION_ORG_OVERWRITE_KEY] && authorized_user.admin?
         
     | 
| 
      
 75 
     | 
    
         
            +
                    @organization = Kadmin::Organization.find_by!(name: session[AuthController::SESSION_ORG_OVERWRITE_KEY])
         
     | 
| 
      
 76 
     | 
    
         
            +
                  else
         
     | 
| 
      
 77 
     | 
    
         
            +
                    @organization = Kadmin::Organization.find_by!(name: authorized_user.organization)
         
     | 
| 
       73 
78 
     | 
    
         
             
                  end
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
                  return @organization
         
     | 
| 
       74 
81 
     | 
    
         
             
                rescue ActiveRecord::RecordNotFound
         
     | 
| 
       75 
82 
     | 
    
         
             
                  render plain: "Forbidden - organization #{authorized_user.organization} not found in DB", status: :forbidden
         
     | 
| 
       76 
83 
     | 
    
         
             
                end
         
     | 
| 
         @@ -1,6 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Kadmin
         
     | 
| 
       2 
2 
     | 
    
         
             
              class AuthController < Kadmin::ApplicationController
         
     | 
| 
       3 
3 
     | 
    
         
             
                SESSION_KEY = 'kadmin.user'.freeze
         
     | 
| 
      
 4 
     | 
    
         
            +
                SESSION_ORG_OVERWRITE_KEY = 'kadmin.org_overwrite'.freeze
         
     | 
| 
       4 
5 
     | 
    
         | 
| 
       5 
6 
     | 
    
         
             
                # Don't try to authenticate user on the authentication controller...
         
     | 
| 
       6 
7 
     | 
    
         
             
                skip_before_action :authorize
         
     | 
| 
         @@ -63,7 +64,7 @@ module Kadmin 
     | 
|
| 
       63 
64 
     | 
    
         
             
                # POST /change_organization
         
     | 
| 
       64 
65 
     | 
    
         
             
                def change_organization
         
     | 
| 
       65 
66 
     | 
    
         
             
                  if authorized_user&.admin?
         
     | 
| 
       66 
     | 
    
         
            -
                     
     | 
| 
      
 67 
     | 
    
         
            +
                    session[SESSION_ORG_OVERWRITE_KEY] = Kadmin::Organization.find(params[:organization_id]).name
         
     | 
| 
       67 
68 
     | 
    
         
             
                  end
         
     | 
| 
       68 
69 
     | 
    
         
             
                  redirect_to :dash
         
     | 
| 
       69 
70 
     | 
    
         
             
                end
         
     | 
| 
         @@ -22,7 +22,7 @@ 
     | 
|
| 
       22 
22 
     | 
    
         
             
                      <div class="header-block header-block-nav">
         
     | 
| 
       23 
23 
     | 
    
         
             
                        <ul class="nav-profile">
         
     | 
| 
       24 
24 
     | 
    
         
             
                          <% if logged_in? %>
         
     | 
| 
       25 
     | 
    
         
            -
                            <% if  
     | 
| 
      
 25 
     | 
    
         
            +
                            <% if authorized_user.admin? %>
         
     | 
| 
       26 
26 
     | 
    
         
             
                              <%= form_tag(Kadmin::Engine.routes.url_helpers.auth_change_organization_path) do -%>
         
     | 
| 
       27 
27 
     | 
    
         
             
                              <%= select_tag('organization_id', options_from_collection_for_select(Kadmin::Organization.all, :id, :name, @organization.id), onchange: "this.form.submit();", class: 'form-control')%>
         
     | 
| 
       28 
28 
     | 
    
         
             
                              <% end -%>
         
     | 
    
        data/lib/kadmin/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: kadmin
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.8
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Nicolas Pepin-Perreault
         
     | 
| 
         @@ -10,7 +10,7 @@ authors: 
     | 
|
| 
       10 
10 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       11 
11 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       12 
12 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       13 
     | 
    
         
            -
            date: 2018-12- 
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2018-12-07 00:00:00.000000000 Z
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies:
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       16 
16 
     | 
    
         
             
              name: rails
         
     |