App-Dochazka-WWW

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

0.109  2014-09-23 09:29 CEST
- bring in empProfileUpdate action (adapt from pre-split version)

0.110  2014-09-23 18:10 CEST
- prototypes.js: bring in Dochazka-specific prototype
- emp-profile-update.js: create empProfile object and merge into it the object
  we get from form submit - this endows our object with the "sanitize" method
- status: 'empProfileUpdate' target working now

0.111  2014-09-24 08:03 CEST
- restore basic change password functionality

0.112  2014-09-24 10:21 CEST
- redesign changePassword dialog - it now asks for confirmation, but the
  password is still displayed on-screen (ick!)

0.113  2014-09-24 11:55 CEST
- emp-lib.js: when password change is saved successfully, display "Password
  changed" message instead of "Employee profile updated"

0.114  2014-09-24 16:41 CEST
- js/: migrate lots of employee profile code from previous incarnation
- status: new employee functionality works as long as non-ASCII characters
  are not entered; when non-ASCII characters are entered, the REST server
  inserts the employee properly but 500 Internal Server Error is returned
  because Plack::MiddleWare::Lint detects wide characters in the entity
  body (unknown ATM whether request or response)

Changes  view on Meta::CPAN

- build/ops: require App::MFILE::WWW 0.141

0.129 2016-09-12 10:27 CEST
- build/ops: change OBS project to Application:Dochazka:staging
- build/ops: add Dispatch.pm to MANIFEST

0.130 2016-09-12 11:58 CEST
- add systemd unit file (Theo Chatzimichos)

0.131 2016-09-12 20:43 CEST
- js: fix "Change my password" functionality
- config: add new file WWW_Message_en.conf
- js: fix "New employee" functionality
- js: fix "Search employee" functionality

0.132 2016-09-15 13:41 CEST
- js: percent-encode employee search keys
- bin/dochazka-www: uncomment --sitedir /etc/dochazka-www
- build/ops: new file WWW_SiteConfig.pm.example

0.133 2016-09-16 00:24 CEST
- config: drop derived distro site config file
- MANIFEST: drop share/config/WWW_SiteConfig.pm
- js: replace EID with sec_id in Employee profile
- build/ops: require most recent App::MFILE::WWW
- js: drop password change option from Employee profile menu

0.134 2016-09-19 12:48 CEST
- build/ops: require App::MFILE::WWW 0.143
- js: minor reformatting in dochazka-www/dform-init.js
- Use employee/self/full resource instead of employee/current/priv
- In employee/self/full resource, current_emp prop renamed to "emp"

0.135 2016-09-25 10:01 CEST
- build/ops: require REST 0.546 and MFILE::WWW 0.144

0.136 2016-09-25 12:03 CEST
- dform-init.js: add status, statusSince empProfile entries
- js: drop dispEmployee target
- Make "My profile" display "Status" and "Status since"
- Rename empProfileEdit target to empProfileEditRemark
- emp-lib.js: separate myProfile function
- Make "Edit remark" display updated employee profile

0.137 2016-09-25 21:47 CEST
- Fix hook in empProfileEditRemark
- Rip out password change feature
- Fix "My profile" + Masquerade mode
- Replace "newEmployee" target with "ldapLookup"
- Replace "newEmplSubmit" with "ldapLookupSubmit"
- Rip out "insertEmployee" target
- Implement "LDAP lookup" feature
- Provide masquerade option if LDAP lookup succeeds

0.138 2016-09-27 16:59 CEST
- Move privHistory target to Employee menu
- ldapLookup: always display AJAX error

ext/WWW_SiteConfig.pm.example  view on Meta::CPAN

set( 'MFILE_WWW_LOG_FILE_RESET', 1 );

# MFILE_WWW_BYPASS_LOGIN_DIALOG
#     If you are the only one using Dochazka at your site, you can bypass
#     the login dialog using this parameter and the next one. Obviously, 
#     doing so is in violation of every security rule known to man.
set( 'MFILE_WWW_BYPASS_LOGIN_DIALOG', 0 );

# MFILE_WWW_DEFAULT_LOGIN_CREDENTIALS
#     If the login dialog is bypassed, App::Dochazka::WWW will attempt to 
#     log the user in with these credentials. Putting passwords in
#     configuration files is extremely foolish and should never be done.
set( 'MFILE_WWW_DEFAULT_LOGIN_CREDENTIALS', {
    'nam' => 'root',
    'pwd' => 'immutable'
} );

# MFILE_WWW_DISPLAY_SESSION_DATA
#     controls whether session data will be displayed on all screens
set( 'MFILE_WWW_DISPLAY_SESSION_DATA', 1 );

lib/App/Dochazka/WWW/Dispatch.pm  view on Meta::CPAN


=cut

sub validate_user_credentials {
    my ( $self, $body ) = @_;
    $log->debug( "Entering " . __PACKAGE__ . "::validate_user_credentials()" );

    my $r = $self->request;
    my $session = $self->session;
    my $nick = $body->{'nam'};
    my $password = $body->{'pwd'};
    my $standalone = $meta->META_WWW_STANDALONE_MODE;

    $log->debug( "Employee $nick login attempt" );
    $log->debug( "DOCHAZKA_WWW_BACKEND_URI is " .  $site->DOCHAZKA_WWW_BACKEND_URI );

    my ( $code, $message, $body_json );
    my $rr = $self->rest_req( {
        server => $site->DOCHAZKA_WWW_BACKEND_URI,
        nick => $nick,
        password => $password,
        path => 'employee/self/full',
    } );
    $code = $rr->{'hr'}->code;
    $message = $rr->{'hr'}->message;
    $body_json = $rr->{'body'};

    my $status = $self->login_status( $code, $message, $body_json );
    $log->debug( "login_status() returned" . Dumper( $status ) );
    return $status;
}

share/js/dochazka-www/canned-tests.js  view on Meta::CPAN


        "contains": containsFunc,

        "employeeCreate": function (assert, nick) {
            var rest = {
                    "method": 'POST',
                    "path": 'employee/nick',
                    "body": {
                        "nick": nick,
                        "fullname": nick + " user",
                        "password": nick,
                    },
                },
                // success callback
                sc = function (st) {
                    console.log("AJAX " + rest["path"] + " success:", st);
                    assert.strictEqual(st.code, 'DOCHAZKA_CUD_OK');
                },
                // failure callback
                fc = function (st) {
                    console.log("AJAX " + rest["path"] + " failure:", st);

share/js/dochazka-www/prototypes.js  view on Meta::CPAN

                ]);
                console.log("Sanitized empProfile", sanitized);
                return sanitized;
            }
        },
        empObject: {
            eid: null,
            nick: null,
            fullname: null,
            email: null,
            password: null,
            remark: null,
            sec_id: null,
            sanitize: function () {
                // object might contain properties that don't belong -
                // this method removes them
                var sanitized = lib.hairCut(this, [
                    'eid', 'nick', 'fullname', 'email', 'password', 'remark',
                    'sec_id'
                ]);
                console.log("Sanitized empObject", sanitized);
                return sanitized;
            }
        },
        ldapEmpObject: {
            eid: null,
            nick: null,
            fullname: null,
            email: null,
            password: null,
            remark: null,
            sec_id: null,
            dochazka: null,
            sanitize: function () {
                // object might contain properties that don't belong -
                // this method removes them
                var sanitized = lib.hairCut(this, [
                    'eid', 'nick', 'fullname', 'email', 'password', 'remark',
                    'sec_id', 'dochazka'
                ]);
                console.log("Sanitized empObject", sanitized);
                return sanitized;
            }
        },
        schedObjectForCreate: {
            scode: null,
            schedule: null,
            sanitize: function () {



( run in 0.724 second using v1.01-cache-2.11-cpan-49f99fa48dc )