Commit c37e54cd authored by Thomas Schneider's avatar Thomas Schneider

Initial import

parents
/.bundle
/vendor/bundle
/config.yml
/public
source 'https://rubygems.org'
gem 'bootstrap', '~> 4.3'
gem 'font-awesome-sass', '~> 5.8'
gem 'haml', '~> 5.0'
gem 'net-ldap', '~> 0.16.1'
gem 'sinatra', '~> 2.0'
gem 'sinatra-asset-pipeline', '~> 2.2'
gem 'sinatra-contrib', '~> 2.0'
gem 'uglifier', '~> 4.1'
group :development do
gem 'rerun', require: false
gem 'rubocop', '~> 0.66.0', require: false
end
GEM
remote: https://rubygems.org/
specs:
actionpack (5.2.2.1)
actionview (= 5.2.2.1)
activesupport (= 5.2.2.1)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.2.1)
activesupport (= 5.2.2.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activesupport (5.2.2.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
ast (2.4.0)
autoprefixer-rails (9.5.0)
execjs
backports (3.12.0)
bootstrap (4.3.1)
autoprefixer-rails (>= 9.1.0)
popper_js (>= 1.14.3, < 2)
sassc-rails (>= 2.0.0)
builder (3.2.3)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.1.5)
crass (1.0.4)
erubi (1.8.0)
execjs (2.7.0)
ffi (1.10.0)
font-awesome-sass (5.8.1)
sassc (>= 1.11)
haml (5.0.4)
temple (>= 0.8.0)
tilt
i18n (1.6.0)
concurrent-ruby (~> 1.0)
jaro_winkler (1.5.2)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.2.3)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
method_source (0.9.2)
mini_portile2 (2.4.0)
minitest (5.11.3)
multi_json (1.13.1)
mustermann (1.0.3)
net-ldap (0.16.1)
nokogiri (1.10.1)
mini_portile2 (~> 2.4.0)
parallel (1.15.0)
parser (2.6.2.0)
ast (~> 2.4.0)
popper_js (1.14.5)
psych (3.1.0)
rack (2.0.6)
rack-protection (2.0.5)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
railties (5.2.2.1)
actionpack (= 5.2.2.1)
activesupport (= 5.2.2.1)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
rainbow (3.0.0)
rake (12.3.2)
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
rerun (0.13.0)
listen (~> 3.0)
rubocop (0.66.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.5, != 2.5.1.1)
psych (>= 3.1.0)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.6)
ruby-progressbar (1.10.0)
ruby_dep (1.5.0)
sass (3.7.3)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sassc (2.0.1)
ffi (~> 1.9)
rake
sassc-rails (2.1.0)
railties (>= 4.0.0)
sassc (>= 2.0)
sprockets (> 3.0)
sprockets-rails
tilt
sinatra (2.0.5)
mustermann (~> 1.0)
rack (~> 2.0)
rack-protection (= 2.0.5)
tilt (~> 2.0)
sinatra-asset-pipeline (2.2.0)
coffee-script (~> 2.4)
rake (~> 12.3)
sass (~> 3.5)
sinatra (~> 2.0)
sprockets (~> 3.7)
sprockets-helpers (~> 1.2)
sinatra-contrib (2.0.5)
backports (>= 2.8.2)
multi_json
mustermann (~> 1.0)
rack-protection (= 2.0.5)
sinatra (= 2.0.5)
tilt (>= 1.3, < 3)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-helpers (1.2.1)
sprockets (>= 2.2)
sprockets-rails (3.2.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
temple (0.8.1)
thor (0.20.3)
thread_safe (0.3.6)
tilt (2.0.9)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (4.1.20)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.5.0)
PLATFORMS
ruby
DEPENDENCIES
bootstrap (~> 4.3)
font-awesome-sass (~> 5.8)
haml (~> 5.0)
net-ldap (~> 0.16.1)
rerun
rubocop (~> 0.66.0)
sinatra (~> 2.0)
sinatra-asset-pipeline (~> 2.2)
sinatra-contrib (~> 2.0)
uglifier (~> 4.1)
BUNDLED WITH
2.0.1
This diff is collapsed.
This diff is collapsed.
require 'sinatra/asset_pipeline/task'
require './usermanager'
Sinatra::AssetPipeline::Task.define! UserManager
require 'rubocop/rake_task'
RuboCop::RakeTask.new
//= require jquery3
//= require popper
//= require bootstrap
This diff is collapsed.
@import "font-awesome-sprockets";
@import "font-awesome";
@import "bootstrap";
require './usermanager'
run UserManager.new
ldap:
host: 'directory.example.com'
base: 'dc=example,dc=com'
bind_dn: 'cn=service,cn=users,dc=example,dc=com'
password: 'Mb2.r5oHf-0t'
require 'sinatra/base'
require 'sinatra/asset_pipeline'
require 'sinatra/config_file'
require 'net/ldap'
require 'bootstrap'
require 'font-awesome-sass'
# Main UserManager application class
class UserManager < Sinatra::Base
set :assets_css_compressor, :sass
set :assets_js_compressor, :uglify
set :assets_paths, %w[assets assets/stylesheets assets/javascripts]
register Sinatra::AssetPipeline
register Sinatra::ConfigFile
config_file 'config.yml'
set :haml, format: :xhtml, content_type: :xhtml, escape_html: true
configure :development do
enable :logging
end
configure do
ldap = Net::LDAP.new(
host: settings.ldap[:host],
port: 636,
encryption: :simple_tls,
auth: {
method: :simple,
username: settings.ldap[:bind_dn],
password: settings.ldap[:password]
},
base: settings.ldap[:base]
)
set :ldap, ldap
end
get '/' do
haml :index
end
get '/list' do
users = settings.ldap.search(
filter: Net::LDAP::Filter.eq('objectClass', 'user')
)
haml :list, locals: { users: users }
end
run! if app_file == $PROGRAM_NAME
end
%h1 Hello World!
%p
Hello world, it’s
%code #{Time.now}
at the server!
%ul
- (23..42).each do |i|
%li= i
\ No newline at end of file
!!! XML
!!! 5
%html{xmlns: 'http://www.w3.org/1999/xhtml'}
%head
%link{rel: 'stylesheet', href: stylesheet_path('app')}
%script{type: 'text/javascript', src: javascript_path('app')}
%meta{name: 'viewport', content: 'width=device-width, initial-scale=1, shrink-to-fit=no'}
%title Usermanager
%body
%nav.navbar.navbar-dark.bg-dark.static-top.navbar-expand-lg
.container
%a.navbar-brand{href: '/'} UserManager
%button.navbar-toggler{type: 'button', data: {toggle: 'collapse', target: '#usermanager-navbar-collapse-1'}, aria: {controls: 'usermanager-navbar-collapse-1', expanded: 'false', label: 'Toggle navigation'}}
%span.navbar-toggler-icon
.collapse.navbar-collapse#usermanager-navbar-collapse-1
.navbar-nav
%a.nav-item.nav-link{href: '/list'} List Users
%span.navbar-text.ml-auto Not logged in
%main.container
!= yield
%h1.pb-2.mt-4.mb-2.border-bottom#content List Users
%table.table.table-striped
%caption List of users
%thead
%tr
%th User ID
%th First Name
%th Last Name
%th Primary Group
%th Groups
%th Status
%tbody
- users.each do |u|
- next unless u.respond_to? :givenname
%tr
%td= u.cn.join(', ')
%td= u.givenname.join(', ')
%td= u.sn.join(', ')
%td= u.gidnumber.join(', ')
%td Groups #FIXME
%td
-#%span{class: [:fas, u[:active] ? 'fa-check' : 'fa-lock'], aria: {hidden: :true}, title: u[:active] ? 'Enabled' : 'Disabled'}
-#%span.sr-only= u[:active] ? 'Enabled' : 'Disabled'
FIXME
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment