├── config_writer ├── __init__.py ├── setup.py └── config_writer.py ├── CHANGES.txt ├── pytest.ini ├── .coveragerc ├── samba_server ├── setup.py └── __init__.py ├── samba4_config_writer ├── setup.py └── __init__.py ├── MANIFEST.in ├── samba4_manager ├── static │ ├── demo │ │ ├── datatables-demo.js │ │ ├── chart-pie-demo.js │ │ ├── chart-bar-demo.js │ │ └── chart-area-demo.js │ ├── vendor │ │ ├── jstree │ │ │ └── themes │ │ │ │ ├── default │ │ │ │ ├── 32px.png │ │ │ │ ├── 40px.png │ │ │ │ ├── throbber.gif │ │ │ │ └── style.min.css │ │ │ │ └── default-dark │ │ │ │ ├── 32px.png │ │ │ │ ├── 40px.png │ │ │ │ └── throbber.gif │ │ ├── fontawesome-free │ │ │ └── webfonts │ │ │ │ ├── fa-solid-900.eot │ │ │ │ ├── fa-solid-900.ttf │ │ │ │ ├── fa-brands-400.eot │ │ │ │ ├── fa-brands-400.ttf │ │ │ │ ├── fa-brands-400.woff │ │ │ │ ├── fa-brands-400.woff2 │ │ │ │ ├── fa-regular-400.eot │ │ │ │ ├── fa-regular-400.ttf │ │ │ │ ├── fa-regular-400.woff │ │ │ │ ├── fa-solid-900.woff │ │ │ │ ├── fa-solid-900.woff2 │ │ │ │ └── fa-regular-400.woff2 │ │ ├── jquery-easing │ │ │ ├── jquery.easing.compatibility.js │ │ │ ├── jquery.easing.min.js │ │ │ └── jquery.easing.js │ │ ├── datatables │ │ │ ├── dataTables.bootstrap4.min.js │ │ │ ├── dataTables.bootstrap4.min.css │ │ │ ├── dataTables.bootstrap4.js │ │ │ └── dataTables.bootstrap4.css │ │ └── bootstrap │ │ │ └── css │ │ │ ├── bootstrap-reboot.min.css │ │ │ └── bootstrap-reboot.css │ ├── sb-admin.scss │ ├── _utilities.scss │ ├── _cards.scss │ ├── _footer.scss │ ├── _mixins.scss │ ├── sb-admin.min.js │ ├── _variables.scss │ ├── sb-admin.js │ ├── _global.scss │ ├── _login.scss │ ├── _navbar.scss │ ├── sb-admin.min.css │ └── sb-admin.css ├── tests.py ├── templates │ ├── editar_share.jinja2 │ ├── LICENSE │ ├── editar_usuario.jinja2 │ ├── agregar_usuario.jinja2 │ ├── editar_computadora.jinja2 │ ├── listar_avanzado.jinja2 │ ├── login.jinja2 │ ├── listar_grupos.jinja2 │ ├── listar_shares.jinja2 │ ├── listar_computadoras.jinja2 │ ├── listar_usuarios.jinja2 │ ├── forgot-password.jinja2 │ ├── register.jinja2 │ ├── blank.jinja2 │ ├── 404.jinja2 │ ├── base.jinja2 │ └── charts.jinja2 ├── authorization.py ├── authentication.py ├── model.py ├── __init__.py └── views.py ├── pyramid.wsgi ├── .project ├── production.ini ├── development.ini ├── setup.py ├── .gitignore └── README.md /config_writer/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /CHANGES.txt: -------------------------------------------------------------------------------- 1 | 0.0 2 | --- 3 | 4 | - Initial version. 5 | -------------------------------------------------------------------------------- /pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | testpaths = samba4_manager 3 | python_files = *.py 4 | -------------------------------------------------------------------------------- /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | source = samba4_manager 3 | omit = samba4_manager/test* 4 | -------------------------------------------------------------------------------- /samba_server/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup(name="samba_server") -------------------------------------------------------------------------------- /config_writer/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup(name="config_writer") -------------------------------------------------------------------------------- /samba4_config_writer/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup(name="samba4_config_writer") -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include *.txt *.ini *.cfg *.rst 2 | recursive-include samba4_manager *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml *.jinja2 3 | -------------------------------------------------------------------------------- /samba4_manager/static/demo/datatables-demo.js: -------------------------------------------------------------------------------- 1 | // Call the dataTables jQuery plugin 2 | $(document).ready(function() { 3 | $('#dataTable').DataTable(); 4 | }); 5 | -------------------------------------------------------------------------------- /samba4_manager/static/vendor/jstree/themes/default/32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxcurson/samba4_manager/HEAD/samba4_manager/static/vendor/jstree/themes/default/32px.png -------------------------------------------------------------------------------- /samba4_manager/static/vendor/jstree/themes/default/40px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxcurson/samba4_manager/HEAD/samba4_manager/static/vendor/jstree/themes/default/40px.png -------------------------------------------------------------------------------- /samba4_manager/static/vendor/jstree/themes/default-dark/32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxcurson/samba4_manager/HEAD/samba4_manager/static/vendor/jstree/themes/default-dark/32px.png -------------------------------------------------------------------------------- /samba4_manager/static/vendor/jstree/themes/default-dark/40px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxcurson/samba4_manager/HEAD/samba4_manager/static/vendor/jstree/themes/default-dark/40px.png -------------------------------------------------------------------------------- /samba4_manager/static/vendor/jstree/themes/default/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxcurson/samba4_manager/HEAD/samba4_manager/static/vendor/jstree/themes/default/throbber.gif -------------------------------------------------------------------------------- /samba4_manager/static/vendor/jstree/themes/default-dark/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxcurson/samba4_manager/HEAD/samba4_manager/static/vendor/jstree/themes/default-dark/throbber.gif -------------------------------------------------------------------------------- /pyramid.wsgi: -------------------------------------------------------------------------------- 1 | from pyramid.paster import get_app, setup_logging 2 | ini_path = '/var/www/html/samba4_manager/development.ini' 3 | setup_logging(ini_path) 4 | application = get_app(ini_path, 'main') 5 | -------------------------------------------------------------------------------- /samba4_manager/static/vendor/fontawesome-free/webfonts/fa-solid-900.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxcurson/samba4_manager/HEAD/samba4_manager/static/vendor/fontawesome-free/webfonts/fa-solid-900.eot -------------------------------------------------------------------------------- /samba4_manager/static/vendor/fontawesome-free/webfonts/fa-solid-900.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxcurson/samba4_manager/HEAD/samba4_manager/static/vendor/fontawesome-free/webfonts/fa-solid-900.ttf -------------------------------------------------------------------------------- /samba4_manager/static/vendor/fontawesome-free/webfonts/fa-brands-400.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxcurson/samba4_manager/HEAD/samba4_manager/static/vendor/fontawesome-free/webfonts/fa-brands-400.eot -------------------------------------------------------------------------------- /samba4_manager/static/vendor/fontawesome-free/webfonts/fa-brands-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxcurson/samba4_manager/HEAD/samba4_manager/static/vendor/fontawesome-free/webfonts/fa-brands-400.ttf -------------------------------------------------------------------------------- /samba4_manager/static/vendor/fontawesome-free/webfonts/fa-brands-400.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxcurson/samba4_manager/HEAD/samba4_manager/static/vendor/fontawesome-free/webfonts/fa-brands-400.woff -------------------------------------------------------------------------------- /samba4_manager/static/vendor/fontawesome-free/webfonts/fa-brands-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxcurson/samba4_manager/HEAD/samba4_manager/static/vendor/fontawesome-free/webfonts/fa-brands-400.woff2 -------------------------------------------------------------------------------- /samba4_manager/static/vendor/fontawesome-free/webfonts/fa-regular-400.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxcurson/samba4_manager/HEAD/samba4_manager/static/vendor/fontawesome-free/webfonts/fa-regular-400.eot -------------------------------------------------------------------------------- /samba4_manager/static/vendor/fontawesome-free/webfonts/fa-regular-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxcurson/samba4_manager/HEAD/samba4_manager/static/vendor/fontawesome-free/webfonts/fa-regular-400.ttf -------------------------------------------------------------------------------- /samba4_manager/static/vendor/fontawesome-free/webfonts/fa-regular-400.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxcurson/samba4_manager/HEAD/samba4_manager/static/vendor/fontawesome-free/webfonts/fa-regular-400.woff -------------------------------------------------------------------------------- /samba4_manager/static/vendor/fontawesome-free/webfonts/fa-solid-900.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxcurson/samba4_manager/HEAD/samba4_manager/static/vendor/fontawesome-free/webfonts/fa-solid-900.woff -------------------------------------------------------------------------------- /samba4_manager/static/vendor/fontawesome-free/webfonts/fa-solid-900.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxcurson/samba4_manager/HEAD/samba4_manager/static/vendor/fontawesome-free/webfonts/fa-solid-900.woff2 -------------------------------------------------------------------------------- /samba4_manager/static/vendor/fontawesome-free/webfonts/fa-regular-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxcurson/samba4_manager/HEAD/samba4_manager/static/vendor/fontawesome-free/webfonts/fa-regular-400.woff2 -------------------------------------------------------------------------------- /samba4_manager/static/sb-admin.scss: -------------------------------------------------------------------------------- 1 | @import "variables.scss"; 2 | @import "mixins.scss"; 3 | @import "global.scss"; 4 | @import "utilities.scss"; 5 | @import "navbar.scss"; 6 | @import "cards.scss"; 7 | @import "login.scss"; 8 | @import "footer.scss"; 9 | -------------------------------------------------------------------------------- /samba4_manager/static/_utilities.scss: -------------------------------------------------------------------------------- 1 | // Additional Text Helper Class 2 | .smaller { 3 | font-size: 0.7rem; 4 | } 5 | 6 | // Helper class for the overflow property 7 | .o-hidden { 8 | overflow: hidden !important; 9 | } 10 | 11 | // Helper classes for z-index 12 | .z-0 { 13 | z-index: 0; 14 | } 15 | 16 | .z-1 { 17 | z-index: 1; 18 | } 19 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | samba4_manager 4 | 5 | 6 | 7 | 8 | 9 | org.python.pydev.PyDevBuilder 10 | 11 | 12 | 13 | 14 | 15 | org.python.pydev.pythonNature 16 | 17 | 18 | -------------------------------------------------------------------------------- /samba4_manager/static/_cards.scss: -------------------------------------------------------------------------------- 1 | // Styling for custom cards 2 | // Custom class for the background icon in card blocks 3 | .card-body-icon { 4 | position: absolute; 5 | z-index: 0; 6 | top: -1.25rem; 7 | right: -1rem; 8 | opacity: 0.4; 9 | 10 | font-size: 5rem; 11 | @include rotate; 12 | } 13 | 14 | // Override breakpoints for card columns to work well with sidebar layout 15 | .card-columns { 16 | @media (min-width: 576px) { 17 | column-count: 1; 18 | } 19 | @media (min-width: 768px) { 20 | column-count: 2; 21 | } 22 | @media (min-width: 1200px) { 23 | column-count: 2; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /samba4_manager/static/_footer.scss: -------------------------------------------------------------------------------- 1 | footer.sticky-footer { 2 | display: flex; 3 | position: absolute; 4 | right: 0; 5 | bottom: 0; 6 | width: calc(100% - #{$sidebar-collapsed-width}); 7 | height: $sticky-footer-height; 8 | background-color: $gray-200; 9 | .copyright { 10 | line-height: 1; 11 | font-size: 0.8rem; 12 | } 13 | @media (min-width: 768px) { 14 | width: calc(100% - #{$sidebar-base-width}); 15 | } 16 | } 17 | 18 | body.sidebar-toggled { 19 | footer.sticky-footer { 20 | width: 100%; 21 | } 22 | @media (min-width: 768px) { 23 | footer.sticky-footer { 24 | width: calc(100% - #{$sidebar-collapsed-width}); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /samba4_manager/static/demo/chart-pie-demo.js: -------------------------------------------------------------------------------- 1 | // Set new default font family and font color to mimic Bootstrap's default styling 2 | Chart.defaults.global.defaultFontFamily = '-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif'; 3 | Chart.defaults.global.defaultFontColor = '#292b2c'; 4 | 5 | // Pie Chart Example 6 | var ctx = document.getElementById("myPieChart"); 7 | var myPieChart = new Chart(ctx, { 8 | type: 'pie', 9 | data: { 10 | labels: ["Blue", "Red", "Yellow", "Green"], 11 | datasets: [{ 12 | data: [12.21, 15.58, 11.25, 8.32], 13 | backgroundColor: ['#007bff', '#dc3545', '#ffc107', '#28a745'], 14 | }], 15 | }, 16 | }); 17 | -------------------------------------------------------------------------------- /samba4_manager/static/_mixins.scss: -------------------------------------------------------------------------------- 1 | @mixin rotate { 2 | transform: rotate(15deg); 3 | } 4 | 5 | @mixin sidebar-icons { 6 | .nav-item { 7 | &:last-child { 8 | margin-bottom: 1rem; 9 | } 10 | .nav-link { 11 | text-align: center; 12 | padding: 0.75rem 1rem; 13 | width: $sidebar-collapsed-width; 14 | span { 15 | font-size: 0.65rem; 16 | display: block; 17 | } 18 | } 19 | .dropdown-menu { 20 | position: absolute !important; 21 | transform: none !important; 22 | left: calc(#{$sidebar-collapsed-width} + 0.5rem) !important; 23 | margin: 0; 24 | &.dropup { 25 | bottom: 0; 26 | top: auto !important; 27 | } 28 | } 29 | &.dropdown .dropdown-toggle::after { 30 | display: none; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /samba4_manager/tests.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from pyramid import testing 4 | 5 | 6 | class ViewTests(unittest.TestCase): 7 | def setUp(self): 8 | self.config = testing.setUp() 9 | 10 | def tearDown(self): 11 | testing.tearDown() 12 | 13 | def test_my_view(self): 14 | from .views import my_view 15 | request = testing.DummyRequest() 16 | info = my_view(request) 17 | self.assertEqual(info['project'], 'Samba4 Manager') 18 | 19 | 20 | class FunctionalTests(unittest.TestCase): 21 | def setUp(self): 22 | from samba4_manager import main 23 | app = main({}) 24 | from webtest import TestApp 25 | self.testapp = TestApp(app) 26 | 27 | def test_root(self): 28 | res = self.testapp.get('/', status=200) 29 | self.assertTrue(b'Pyramid' in res.body) 30 | -------------------------------------------------------------------------------- /samba4_config_writer/__init__.py: -------------------------------------------------------------------------------- 1 | from reconfigure.configs import SambaConfig 2 | 3 | class SambaConfigWriter(object): 4 | def __init__(self): 5 | self.config_file="/etc/samba/smb.conf" 6 | self.config=SambaConfig(path=self.config_file) 7 | self.config.load() 8 | def listar_shares(self): 9 | return self.config.tree.shares 10 | def obtener_share(self,nombre): 11 | # Recorramos la lista de shares y extraigamos aquella que nos sirve. 12 | share_encontrada=() 13 | encontrado=False 14 | cant_shares=len(self.config.tree.shares) 15 | share_actual=0 16 | while(share_actual 6 | Shares 7 | 8 | {% endblock %} 9 | {% block breadcrumb_active_item %} 10 | 11 | {% endblock %} 12 | {% block sidebar_shares %}active{% endblock %} 13 | {% block content %} 14 |
15 |
16 | {{ form.dn.label(class="col-sm-2 col-form-label") }} 17 |
18 | {{ form.dn(class="form-control")}} 19 |
20 |
21 |
22 | {{ form.samaccountname.label(class="col-sm-2 col-form-label") }} 23 |
24 | {{ form.samaccountname(class="form-control")}} 25 |
26 |
27 |
28 | {% endblock %} -------------------------------------------------------------------------------- /samba4_manager/static/_variables.scss: -------------------------------------------------------------------------------- 1 | // Color Variables 2 | // Bootstrap Color Defaults 3 | $white: #fff !default; 4 | $gray-100: #f8f9fa !default; 5 | $gray-200: #e9ecef !default; 6 | $gray-300: #dee2e6 !default; 7 | $gray-400: #ced4da !default; 8 | $gray-500: #adb5bd !default; 9 | $gray-600: #868e96 !default; 10 | $gray-700: #495057 !default; 11 | $gray-800: #343a40 !default; 12 | $gray-900: #212529 !default; 13 | $black: #000 !default; 14 | 15 | $blue: #007bff !default; 16 | $indigo: #6610f2 !default; 17 | $purple: #6f42c1 !default; 18 | $pink: #e83e8c !default; 19 | $red: #dc3545 !default; 20 | $orange: #fd7e14 !default; 21 | $yellow: #ffc107 !default; 22 | $green: #28a745 !default; 23 | $teal: #20c997 !default; 24 | $cyan: #17a2b8 !default; 25 | 26 | // Spacing Variables 27 | // Change below variable if the height of the navbar changes 28 | $navbar-base-height: 56px; 29 | // Change below variable to change the width of the sidenav 30 | $sidebar-base-width: 225px; 31 | // Change below variable to change the width of the sidenav when collapsed 32 | $sidebar-collapsed-width: 90px; 33 | // Change below variable to change the height of the sticky footer 34 | $sticky-footer-height: 80px; 35 | -------------------------------------------------------------------------------- /samba4_manager/templates/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-2018 Blackrock Digital LLC 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /production.ini: -------------------------------------------------------------------------------- 1 | ### 2 | # app configuration 3 | # https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html 4 | ### 5 | 6 | [app:main] 7 | use = egg:samba4_manager 8 | 9 | pyramid.reload_templates = false 10 | pyramid.debug_authorization = true 11 | pyramid.debug_notfound = false 12 | pyramid.debug_routematch = false 13 | pyramid.default_locale_name = en 14 | 15 | ### 16 | # wsgi server configuration 17 | ### 18 | 19 | [server:main] 20 | use = egg:waitress#main 21 | listen = *:6543 22 | 23 | ### 24 | # logging configuration 25 | # https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html 26 | ### 27 | 28 | [loggers] 29 | keys = root, samba4_manager 30 | 31 | [handlers] 32 | keys = console 33 | 34 | [formatters] 35 | keys = generic 36 | 37 | [logger_root] 38 | level = WARN 39 | handlers = console 40 | 41 | [logger_samba4_manager] 42 | level = WARN 43 | handlers = 44 | qualname = samba4_manager 45 | 46 | [handler_console] 47 | class = StreamHandler 48 | args = (sys.stderr,) 49 | level = NOTSET 50 | formatter = generic 51 | 52 | [formatter_generic] 53 | format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s 54 | -------------------------------------------------------------------------------- /samba4_manager/authorization.py: -------------------------------------------------------------------------------- 1 | from pyramid.authentication import AuthTktCookieHelper 2 | from pyramid.security import Everyone, Authenticated 3 | 4 | class SambaAdminAuthenticationPolicy: 5 | def __init__(self, secret): 6 | self.authtkt = AuthTktCookieHelper(secret=secret) 7 | 8 | def identity(self, request): 9 | identity = self.authtkt.identify(request) 10 | if identity is not None: 11 | return identity 12 | 13 | def authenticated_userid(self, request): 14 | identity = self.identity(request) 15 | if identity is not None: 16 | return identity['userid'] 17 | 18 | def remember(self, request, userid, **kw): 19 | return self.authtkt.remember(request, userid, **kw) 20 | 21 | def forget(self, request, **kw): 22 | return self.authtkt.forget(request, **kw) 23 | 24 | def effective_principals(self, request): 25 | principals = [Everyone] 26 | userid = self.authenticated_userid(request) 27 | if userid: 28 | principals += [Authenticated, str(userid)] 29 | #user=request.user 30 | #print("El user es %s" % user) 31 | #if user is not None: 32 | # principals.extend(('group:%s' % g for g in user.groups)) 33 | return principals -------------------------------------------------------------------------------- /samba4_manager/static/demo/chart-bar-demo.js: -------------------------------------------------------------------------------- 1 | // Set new default font family and font color to mimic Bootstrap's default styling 2 | Chart.defaults.global.defaultFontFamily = '-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif'; 3 | Chart.defaults.global.defaultFontColor = '#292b2c'; 4 | 5 | // Bar Chart Example 6 | var ctx = document.getElementById("myBarChart"); 7 | var myLineChart = new Chart(ctx, { 8 | type: 'bar', 9 | data: { 10 | labels: ["January", "February", "March", "April", "May", "June"], 11 | datasets: [{ 12 | label: "Revenue", 13 | backgroundColor: "rgba(2,117,216,1)", 14 | borderColor: "rgba(2,117,216,1)", 15 | data: [4215, 5312, 6251, 7841, 9821, 14984], 16 | }], 17 | }, 18 | options: { 19 | scales: { 20 | xAxes: [{ 21 | time: { 22 | unit: 'month' 23 | }, 24 | gridLines: { 25 | display: false 26 | }, 27 | ticks: { 28 | maxTicksLimit: 6 29 | } 30 | }], 31 | yAxes: [{ 32 | ticks: { 33 | min: 0, 34 | max: 15000, 35 | maxTicksLimit: 5 36 | }, 37 | gridLines: { 38 | display: true 39 | } 40 | }], 41 | }, 42 | legend: { 43 | display: false 44 | } 45 | } 46 | }); 47 | -------------------------------------------------------------------------------- /samba4_manager/static/sb-admin.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | "use strict"; // Start of use strict 3 | 4 | // Toggle the side navigation 5 | $("#sidebarToggle").click(function(e) { 6 | e.preventDefault(); 7 | $("body").toggleClass("sidebar-toggled"); 8 | $(".sidebar").toggleClass("toggled"); 9 | }); 10 | 11 | // Prevent the content wrapper from scrolling when the fixed side navigation hovered over 12 | $('body.fixed-nav .sidebar').on('mousewheel DOMMouseScroll wheel', function(e) { 13 | if ($window.width() > 768) { 14 | var e0 = e.originalEvent, 15 | delta = e0.wheelDelta || -e0.detail; 16 | this.scrollTop += (delta < 0 ? 1 : -1) * 30; 17 | e.preventDefault(); 18 | } 19 | }); 20 | 21 | // Scroll to top button appear 22 | $(document).scroll(function() { 23 | var scrollDistance = $(this).scrollTop(); 24 | if (scrollDistance > 100) { 25 | $('.scroll-to-top').fadeIn(); 26 | } else { 27 | $('.scroll-to-top').fadeOut(); 28 | } 29 | }); 30 | 31 | // Smooth scrolling using jQuery easing 32 | $(document).on('click', 'a.scroll-to-top', function(event) { 33 | var $anchor = $(this); 34 | $('html, body').stop().animate({ 35 | scrollTop: ($($anchor.attr('href')).offset().top) 36 | }, 1000, 'easeInOutExpo'); 37 | event.preventDefault(); 38 | }); 39 | 40 | })(jQuery); // End of use strict 41 | -------------------------------------------------------------------------------- /samba4_manager/static/_global.scss: -------------------------------------------------------------------------------- 1 | // Global styling for this template 2 | 3 | html { 4 | position: relative; 5 | min-height: 100%; 6 | } 7 | 8 | body { 9 | height: 100%; 10 | } 11 | 12 | #wrapper { 13 | display: flex; 14 | #content-wrapper { 15 | overflow-x: hidden; 16 | width: 100%; 17 | padding-top: 1rem; 18 | padding-bottom: $sticky-footer-height; 19 | } 20 | } 21 | // Fixed Nav Option 22 | body.fixed-nav { 23 | #content-wrapper { 24 | margin-top: $navbar-base-height; 25 | padding-left: $sidebar-collapsed-width; 26 | } 27 | &.sidebar-toggled { 28 | #content-wrapper { 29 | padding-left: 0; 30 | } 31 | } 32 | @media(min-width: 768px) { 33 | #content-wrapper { 34 | padding-left: $sidebar-base-width; 35 | } 36 | &.sidebar-toggled { 37 | #content-wrapper { 38 | padding-left: $sidebar-collapsed-width; 39 | } 40 | } 41 | } 42 | } 43 | 44 | // Scroll to top button 45 | .scroll-to-top { 46 | position: fixed; 47 | right: 15px; 48 | bottom: 15px; 49 | display: none; 50 | width: 50px; 51 | height: 50px; 52 | text-align: center; 53 | color: $white; 54 | background: fade-out($gray-800, .5); 55 | line-height: 46px; 56 | &:focus, 57 | &:hover { 58 | color: white; 59 | } 60 | &:hover { 61 | background: $gray-800; 62 | } 63 | i { 64 | font-weight: 800; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /development.ini: -------------------------------------------------------------------------------- 1 | ### 2 | # app configuration 3 | # https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html 4 | ### 5 | 6 | [app:main] 7 | use = egg:samba4-manager 8 | 9 | pyramid.reload_templates = true 10 | pyramid.debug_authorization = true 11 | pyramid.debug_notfound = true 12 | pyramid.debug_routematch = false 13 | pyramid.default_locale_name = en 14 | pyramid.includes = 15 | pyramid_debugtoolbar 16 | 17 | # By default, the toolbar only appears for clients from IP addresses 18 | # '127.0.0.1' and '::1'. 19 | debugtoolbar.hosts = 127.0.0.1 ::1 192.168.1.1 20 | 21 | ### 22 | # wsgi server configuration 23 | ### 24 | 25 | [server:main] 26 | use = egg:waitress#main 27 | listen = *:6543 28 | 29 | ### 30 | # logging configuration 31 | # https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html 32 | ### 33 | 34 | [loggers] 35 | keys = root, samba4_manager 36 | 37 | [handlers] 38 | keys = console 39 | 40 | [formatters] 41 | keys = generic 42 | 43 | [logger_root] 44 | level = INFO 45 | handlers = console 46 | 47 | [logger_samba4_manager] 48 | level = DEBUG 49 | handlers = 50 | qualname = samba4_manager 51 | 52 | [handler_console] 53 | class = StreamHandler 54 | args = (sys.stderr,) 55 | level = NOTSET 56 | formatter = generic 57 | 58 | [formatter_generic] 59 | format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s 60 | -------------------------------------------------------------------------------- /config_writer/config_writer.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | from secureconfig.secureconfigparser import SecureConfigParser 3 | from secureconfig.cryptkeeper import CryptKeeper 4 | 5 | def main(): 6 | # Main function. 7 | parser=argparse.ArgumentParser("Generates encrypted credentials") 8 | parser.add_argument('--secret-file',help='Name of the file to store the secret encrypted credentials',required=True) 9 | parser.add_argument('--unencrypted-credentials',help='Name of the file that currently stores unencrypted credentials') 10 | parser.add_argument('--key-file',help="Specifies the name of the file where to store the secret key that will unlock the secret file",required=True) 11 | args=vars(parser.parse_args()) 12 | ck=CryptKeeper() 13 | key=ck.generate_key() 14 | # Now, if we received the argument generate-key, let's generate the file 15 | scfg=SecureConfigParser.from_key(key) 16 | scfg.read(args["unencrypted_credentials"]) 17 | username=scfg.get('credentials','username') 18 | password=scfg.get('credentials','password') 19 | scfg.set('credentials','username',username,encrypt=True) 20 | scfg.set('credentials','password',password,encrypt=True) 21 | file=open(args['secret_file'],"w") 22 | scfg.write(file) 23 | file.close() 24 | # Now we store the secret key 25 | secret_file=open(args['key_file'],"w") 26 | secret_file.write(key) 27 | secret_file.close() 28 | # Invoke main function upon execution 29 | if __name__=="__main__": 30 | main() -------------------------------------------------------------------------------- /samba4_manager/templates/editar_usuario.jinja2: -------------------------------------------------------------------------------- 1 | {% extends "base.jinja2" %} 2 | {% block page_title %}Samba4 Manager - Edit users{%endblock%} 3 | {% block breadcrumb_items %} 4 | {{ super() }} 5 | 8 | {% endblock %} 9 | {% block breadcrumb_active_item %} 10 | 11 | {% endblock %} 12 | {% block sidebar_users %}active{% endblock %} 13 | {% block content %} 14 |
15 |
16 | {{ form.dn.label(class="col-sm-2 col-form-label") }} 17 |
18 | {{ form.dn(class="form-control")}} 19 |
20 |
21 |
22 | {{ form.samaccountname.label(class="col-sm-2 col-form-label") }} 23 |
24 | {{ form.samaccountname(class="form-control")}} 25 |
26 |
27 |
28 |
Account Flags
29 |
30 |
31 | {{ form.enabled(class="form-check-input") }} {{ form.enabled.label(class="form-check-label") }} 32 |
33 | {% for subfield in form.account_type %} 34 |
35 | {{ subfield(class="form-check-input") }} 36 | {{ subfield.label(class="form-check-label") }} 37 |
38 | {% endfor %} 39 |
40 |
41 |
42 | {% endblock %} -------------------------------------------------------------------------------- /samba4_manager/templates/agregar_usuario.jinja2: -------------------------------------------------------------------------------- 1 | {% extends "base.jinja2" %} 2 | {% block page_title %}Samba4 Manager - Add users{%endblock%} 3 | {% block breadcrumb_items %} 4 | {{ super() }} 5 | 8 | {% endblock %} 9 | {% block breadcrumb_active_item %} 10 | 11 | {% endblock %} 12 | {% block sidebar_users %}active{% endblock %} 13 | {% block content %} 14 |
15 |
16 | {{ form.dn.label(class="col-sm-2 col-form-label") }} 17 |
18 | {{ form.dn(class="form-control")}} 19 |
20 |
21 |
22 | {{ form.samaccountname.label(class="col-sm-2 col-form-label") }} 23 |
24 | {{ form.samaccountname(class="form-control")}} 25 |
26 |
27 |
28 |
Account Flags
29 |
30 |
31 | {{ form.enabled(class="form-check-input") }} {{ form.enabled.label(class="form-check-label") }} 32 |
33 | {% for subfield in form.account_type %} 34 |
35 | {{ subfield(class="form-check-input") }} 36 | {{ subfield.label(class="form-check-label") }} 37 |
38 | {% endfor %} 39 |
40 |
41 |
42 | {% endblock %} -------------------------------------------------------------------------------- /samba4_manager/templates/editar_computadora.jinja2: -------------------------------------------------------------------------------- 1 | {% extends "base.jinja2" %} 2 | {% block page_title %}Samba4 Manager - Edit computers{%endblock%} 3 | {% block breadcrumb_items %} 4 | {{ super() }} 5 | 8 | {% endblock %} 9 | {% block breadcrumb_active_item %} 10 | 11 | {% endblock %} 12 | {% block sidebar_computers %}active{% endblock %} 13 | {% block content %} 14 |
15 |
16 | {{ form.dn.label(class="col-sm-2 col-form-label") }} 17 |
18 | {{ form.dn(class="form-control")}} 19 |
20 |
21 |
22 | {{ form.samaccountname.label(class="col-sm-2 col-form-label") }} 23 |
24 | {{ form.samaccountname(class="form-control")}} 25 |
26 |
27 |
28 |
Account Flags
29 |
30 |
31 | {{ form.enabled(class="form-check-input") }} {{ form.enabled.label(class="form-check-label") }} 32 |
33 | {% for subfield in form.account_type %} 34 |
35 | {{ subfield(class="form-check-input") }} 36 | {{ subfield.label(class="form-check-label") }} 37 |
38 | {% endfor %} 39 |
40 |
41 |
42 | {% endblock %} -------------------------------------------------------------------------------- /samba4_manager/static/_login.scss: -------------------------------------------------------------------------------- 1 | :root { 2 | --input-padding-x: 0.75rem; 3 | --input-padding-y: 0.75rem; 4 | } 5 | 6 | .card-login { 7 | max-width: 25rem; 8 | } 9 | 10 | .card-register { 11 | max-width: 40rem; 12 | } 13 | 14 | .form-label-group { 15 | position: relative; 16 | } 17 | 18 | .form-label-group > input, 19 | .form-label-group > label { 20 | padding: var(--input-padding-y) var(--input-padding-x); 21 | height: auto; 22 | } 23 | 24 | .form-label-group > label { 25 | position: absolute; 26 | top: 0; 27 | left: 0; 28 | display: block; 29 | width: 100%; 30 | margin-bottom: 0; 31 | /* Override default `