class NetworkShare
Public Instance Methods
layout()
click to toggle source
# File Views/Network/Share.rb, line 4 def layout set_data_class :Shares @order = 50 @update = true @functions_need = [:share] @samba = Entities.Statics.get(:NetworkSamba) if @samba.data_str.class != Hash dputs(4) { "Oups - samba is #{@samba.data_str.inspect}" } @samba.data_str = {} end gui_vbox :nogroup do gui_hbox do gui_vbox :nogroup do vtlp_list :shares, :name show_button :new, :delete end gui_vbox :nogroup do show_block :config, :width => 200 show_button :share_save, :change_path, :add_htaccess end gui_vbox :nogroup do show_list_single :users, :width => 200 show_button :no_access, :read_write, :read_only end end gui_hbox :nogroup do gui_vbox :nogroup do show_str :domain, :width => 200 show_str :hostname show_button :samba_save end gui_vbox :nogroup do end end gui_window :msg do show_html :msg_txt show_button :close end end end
rpc_list_choice(session, name, *args)
click to toggle source
# File Views/Network/Share.rb, line 80 def rpc_list_choice(session, name, *args) dputs(3) { "rpc_list_choice with #{name} - #{args.inspect}" } if name == @vtlp_field session.s_data[:share] = args[0][name][0] dputs(4) { "session.s_data is #{session.s_data.inspect}" } end rpc_list_choice_old(session, name, args[0]) end
Also aliased as: rpc_list_choice_old
rpc_update(session)
click to toggle source
# File Views/Network/Share.rb, line 90 def rpc_update(session) dputs(4) { "Updating samba: #{users_update(session)}" } show_users = reply(:hide, :users) begin if (share_id = session.s_data[:share]) and (Shares.match_by_share_id(share_id).public == ['No']) show_users = reply(:unhide, :users) end rescue NoMethodError end reply(:empty, [:users]) + reply(:update, :users => users_update(session)) + %w( domain hostname ).collect { |d| reply(:update, d => @samba.data_str[d]) }.flatten + show_users end
users_update(session)
click to toggle source
# File Views/Network/Share.rb, line 49 def users_update(session) if session and (share_str = session.s_data[:share]) users = Persons.search_by_groups('share') share = Shares.match_by_share_id(share_str) dputs(3) { "Users is #{users.inspect} and share is #{share.inspect}" } if users and share dputs(3) { "Acl of #{share.name} is #{share.acl.inspect}" } share.acl.collect { |k, v| if user = Persons.match_by_login_name(k) users.delete(user) access = v == 'ro' ? 'read-only' : 'read-write' name = user.full_name name.to_s == 0 and name = user.login_name [k, "#{name}: #{access}"] else nil end }.compact.sort { |a, b| a[1] <=> b[1] } + users.collect { |u| [u.login_name, u.full_name] }.sort { |a, b| a[1] <=> b[1] } else return [] end else return [] end end