Hello community,

here is the log from the commit of package perl-App-MFILE for openSUSE:Factory 
checked in at 2017-10-03 23:17:32
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-App-MFILE (Old)
 and      /work/SRC/openSUSE:Factory/.perl-App-MFILE.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-App-MFILE"

Tue Oct  3 23:17:32 2017 rev:4 rq:530062 version:0.182

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-App-MFILE/perl-App-MFILE.changes    
2016-11-10 13:28:20.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.perl-App-MFILE.new/perl-App-MFILE.changes       
2017-10-03 23:17:36.919629478 +0200
@@ -1,0 +2,11 @@
+Thu Sep 28 05:03:05 UTC 2017 - [email protected]
+
+- updated to 0.182
+   see /usr/share/doc/packages/perl-App-MFILE/Changes
+
+  
+  0.182 2017-09-27 14:43 CEST
+  - Build.PL: require recent App::CELL
+  - HTTP.pm: migrate is_authorized code from mfile-www and dochazka-www
+
+-------------------------------------------------------------------

Old:
----
  App-MFILE-0.181.tar.gz

New:
----
  App-MFILE-0.182.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-App-MFILE.spec ++++++
--- /var/tmp/diff_new_pack.ffLRyF/_old  2017-10-03 23:17:37.507546738 +0200
+++ /var/tmp/diff_new_pack.ffLRyF/_new  2017-10-03 23:17:37.507546738 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package perl-App-MFILE
 #
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,20 +17,20 @@
 
 
 Name:           perl-App-MFILE
-Version:        0.181
+Version:        0.182
 Release:        0
 %define cpan_name App-MFILE
 Summary:        MFILE shared modules
 License:        BSD-3-Clause
 Group:          Development/Libraries/Perl
 Url:            http://search.cpan.org/dist/App-MFILE/
-Source0:        
http://www.cpan.org/authors/id/S/SM/SMITHFARM/%{cpan_name}-%{version}.tar.gz
+Source0:        
https://cpan.metacpan.org/authors/id/S/SM/SMITHFARM/%{cpan_name}-%{version}.tar.gz
 Source1:        cpanspec.yml
 BuildArch:      noarch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildRequires:  perl
 BuildRequires:  perl-macros
-BuildRequires:  perl(App::CELL) >= 0.196
+BuildRequires:  perl(App::CELL) >= 0.222
 BuildRequires:  perl(HTTP::Request::Common)
 BuildRequires:  perl(JSON)
 BuildRequires:  perl(LWP::UserAgent)
@@ -38,7 +38,7 @@
 BuildRequires:  perl(Params::Validate) >= 1.06
 BuildRequires:  perl(Software::License)
 BuildRequires:  perl(Test::Fatal)
-Requires:       perl(App::CELL) >= 0.196
+Requires:       perl(App::CELL) >= 0.222
 Requires:       perl(HTTP::Request::Common)
 Requires:       perl(JSON)
 Requires:       perl(LWP::UserAgent)
@@ -66,6 +66,7 @@
 
 %files -f %{name}.files
 %defattr(-,root,root,755)
-%doc Changes LICENSE README.rst
+%doc Changes README.rst
+%license LICENSE
 
 %changelog

++++++ App-MFILE-0.181.tar.gz -> App-MFILE-0.182.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-MFILE-0.181/Build.PL new/App-MFILE-0.182/Build.PL
--- old/App-MFILE-0.181/Build.PL        2016-11-05 22:33:24.000000000 +0100
+++ new/App-MFILE-0.182/Build.PL        2017-09-27 14:44:58.000000000 +0200
@@ -17,13 +17,13 @@
         'Software::License'  => 0,
     },
     build_requires     => { 
-        'App::CELL'          => 0.196,
+        'App::CELL'          => 0.222,
         'Params::Validate'   => 1.06,
         'Test::Fatal'        => 0,
     },
     requires           => {
         'perl'               => 5.012,
-        'App::CELL'          => 0.196,
+        'App::CELL'          => 0.222,
         'HTTP::Request::Common' => 0,
         'JSON'               => 0,
         'LWP::UserAgent'     => 0,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-MFILE-0.181/Changes new/App-MFILE-0.182/Changes
--- old/App-MFILE-0.181/Changes 2016-11-05 22:33:24.000000000 +0100
+++ new/App-MFILE-0.182/Changes 2017-09-27 14:44:58.000000000 +0200
@@ -127,3 +127,7 @@
 - build/ops: change OBS project back to Application:Dochazka
 - HTTP.pm: Allow rest_req() to send DELETE requests
 
+0.182 2017-09-27 14:43 CEST
+- Build.PL: require recent App::CELL
+- HTTP.pm: migrate is_authorized code from mfile-www and dochazka-www
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-MFILE-0.181/META.json 
new/App-MFILE-0.182/META.json
--- old/App-MFILE-0.181/META.json       2016-11-05 22:33:24.000000000 +0100
+++ new/App-MFILE-0.182/META.json       2017-09-27 14:44:58.000000000 +0200
@@ -4,7 +4,7 @@
       "Smithfarm <[email protected]>"
    ],
    "dynamic_config" : 1,
-   "generated_by" : "Module::Build version 0.4205",
+   "generated_by" : "Module::Build version 0.4003, CPAN::Meta::Converter 
version 2.120921",
    "license" : [
       "bsd"
    ],
@@ -16,7 +16,7 @@
    "prereqs" : {
       "build" : {
          "requires" : {
-            "App::CELL" : "0.196",
+            "App::CELL" : "0.222",
             "Params::Validate" : "1.06",
             "Test::Fatal" : "0"
          }
@@ -29,7 +29,7 @@
       },
       "runtime" : {
          "requires" : {
-            "App::CELL" : "0.196",
+            "App::CELL" : "0.222",
             "HTTP::Request::Common" : "0",
             "JSON" : "0",
             "LWP::UserAgent" : "0",
@@ -41,22 +41,22 @@
    "provides" : {
       "App::MFILE" : {
          "file" : "lib/App/MFILE.pm",
-         "version" : "0.181"
+         "version" : "0.182"
       },
       "App::MFILE::HTTP" : {
-         "file" : "lib/App/MFILE/HTTP.pm"
+         "file" : "lib/App/MFILE/HTTP.pm",
+         "version" : 0
       }
    },
    "release_status" : "stable",
    "resources" : {
       "homepage" : "https://sourceforge.net/projects/mfile/";,
       "license" : [
-         "http://opensource.org/licenses/bsd-license.php";
+         "http://opensource.org/licenses/BSD-3-Clause";
       ],
       "repository" : {
          "url" : "https://sourceforge.net/p/mfile/code/";
       }
    },
-   "version" : "0.181",
-   "x_serialization_backend" : "JSON::PP version 2.27203"
+   "version" : "0.182"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-MFILE-0.181/META.yml new/App-MFILE-0.182/META.yml
--- old/App-MFILE-0.181/META.yml        2016-11-05 22:33:24.000000000 +0100
+++ new/App-MFILE-0.182/META.yml        2017-09-27 14:44:58.000000000 +0200
@@ -3,35 +3,35 @@
 author:
   - 'Smithfarm <[email protected]>'
 build_requires:
-  App::CELL: '0.196'
-  Params::Validate: '1.06'
-  Test::Fatal: '0'
+  App::CELL: 0.222
+  Params::Validate: 1.06
+  Test::Fatal: 0
 configure_requires:
-  Module::Build: '0.37'
-  Software::License: '0'
+  Module::Build: 0.37
+  Software::License: 0
 dynamic_config: 1
-generated_by: 'Module::Build version 0.4205, CPAN::Meta::Converter version 
2.150005'
+generated_by: 'Module::Build version 0.4003, CPAN::Meta::Converter version 
2.120921'
 license: bsd
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
-  version: '1.4'
+  version: 1.4
 name: App-MFILE
 provides:
   App::MFILE:
     file: lib/App/MFILE.pm
-    version: '0.181'
+    version: 0.182
   App::MFILE::HTTP:
     file: lib/App/MFILE/HTTP.pm
+    version: 0
 requires:
-  App::CELL: '0.196'
-  HTTP::Request::Common: '0'
-  JSON: '0'
-  LWP::UserAgent: '0'
-  Params::Validate: '1.06'
-  perl: '5.012'
+  App::CELL: 0.222
+  HTTP::Request::Common: 0
+  JSON: 0
+  LWP::UserAgent: 0
+  Params::Validate: 1.06
+  perl: 5.012
 resources:
   homepage: https://sourceforge.net/projects/mfile/
-  license: http://opensource.org/licenses/bsd-license.php
+  license: http://opensource.org/licenses/BSD-3-Clause
   repository: https://sourceforge.net/p/mfile/code/
-version: '0.181'
-x_serialization_backend: 'CPAN::Meta::YAML version 0.012'
+version: 0.182
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-MFILE-0.181/lib/App/MFILE/HTTP.pm 
new/App-MFILE-0.182/lib/App/MFILE/HTTP.pm
--- old/App-MFILE-0.181/lib/App/MFILE/HTTP.pm   2016-11-05 22:33:24.000000000 
+0100
+++ new/App-MFILE-0.182/lib/App/MFILE/HTTP.pm   2017-09-27 14:44:58.000000000 
+0200
@@ -48,23 +48,23 @@
 use Params::Validate qw( :all );
 use Try::Tiny;
 
+
+
 =head1 NAME
 
 App::MFILE::HTTP - general REST request forwarder for MFILE-based clients
 
 
 
-
 =head1 SYNOPSIS
 
     use App::MFILE::HTTP qw( rest_req );
 
 
 
-
 =head1 DESCRIPTION
 
-Module where C<rest_req> resides.
+Module where C<rest_req> and other shared code resides.
 
 
 
@@ -72,36 +72,16 @@
 
 =cut
 
-our @EXPORT_OK = qw( rest_req );
-
+our @EXPORT_OK = qw(
+    rest_req
+    _is_authorized
+);
 
 
 
 =head1 FUNCTIONS
 
 
-=head2 init_ua
-
-Initialize a LWP::UserAgent singleton object.
-
-Takes two _mandatory_ parameters:
-
-    - a LWP::UserAgent object
-    - a scalar (filename of cookie jar)
-
-=cut
-
-sub init_ua {
-    # process arguments
-    my ( $ua, $cj ) = validate_pos( @_,
-        { type => HASHREF, can => 'cookie_jar' },
-        { type => SCALAR },
-    );
-    $ua->cookie_jar( { file => $cj } );
-    return;
-}
-
-
 =head2 rest_req
 
 Algorithm: send request to REST server, get JSON response, decode it, return 
it.
@@ -178,3 +158,89 @@
     };
 }
 
+
+=head2 _is_authorized
+
+This function does the actual work for C<is_authorized> in the Dispatch.pm
+module of an C<App::MFILE::WWW>-based application.
+
+This function belongs in Dispatch.pm - it is here only to prevent code
+duplication.
+
+=cut
+
+sub _is_authorized {
+    my ( $self ) = @_;
+
+    $log->debug( "Entering " . __PACKAGE__ . "::_is_authorized()" );
+
+    my $r = $self->request;
+    #my $session = $r->{'env'}->{'psgix.session'};
+    my $session = $self->session;
+    #my $remote_addr = $r->{'env'}->{'REMOTE_ADDR'};
+    my $remote_addr = $self->remote_addr;
+    my $ce;
+
+    #$log->debug( "Environment is " . Dumper( $r->{'env'} ) );
+    $log->debug( "Session is " . Dumper( $session ) );
+
+    # authorized session
+    if ( $ce = $session->{'currentUser'} and
+         $session->{'ip_addr'} and
+         $session->{'ip_addr'} eq $remote_addr and
+         _is_fresh( $session ) )
+    {
+        $log->debug( "is_authorized: Authorized session, employee " . 
$ce->{'nick'} );
+        $session->{'last_seen'} = time;
+        return 1;
+    }
+
+    # login attempt
+    if ( $r->method eq 'POST' and
+         $self->context->{'request_body'} and
+         $self->context->{'request_body'}->{'method'} and
+         $self->context->{'request_body'}->{'method'} =~ m/^LOGIN/i ) {
+        $log->debug( "is_authorized: Login attempt - pass it on" );
+        return 1;
+    }
+
+    # login bypass
+    $meta->set('META_LOGIN_BYPASS_STATE', 0) if not defined 
$meta->META_LOGIN_BYPASS_STATE;
+    if ( $site->MFILE_WWW_BYPASS_LOGIN_DIALOG and not 
$meta->META_LOGIN_BYPASS_STATE ) {
+        $log->notice("Bypassing login dialog! Using default credentials");
+        $session->{'ip_addr'} = $remote_addr;
+        $session->{'last_seen'} = time;
+        my $bypass_result = $self->_login_dialog( {
+            'nam' => $site->MFILE_WWW_DEFAULT_LOGIN_CREDENTIALS->{'nam'},
+            'pwd' => $site->MFILE_WWW_DEFAULT_LOGIN_CREDENTIALS->{'pwd'},
+        } );
+        $meta->set('META_LOGIN_BYPASS_STATE', 1);
+        return $bypass_result;
+    }
+
+    # unauthorized session
+    $log->debug( "is_authorized fall-through: " . $r->method . " " . 
$self->request->path_info );
+    return ( $r->method eq 'GET' ) ? 1 : 0;
+}
+
+
+=head2 _is_fresh
+
+Takes a single argument, the PSGI session, which is assumed to contain a
+C<last_seen> attribute containing the number of seconds since epoch when the
+session was last seen.
+
+=cut
+
+sub _is_fresh {
+    my ( $session ) = validate_pos( @_, { type => HASHREF } );
+
+    return 0 unless my $last_seen = $session->{'last_seen'};
+
+    return ( time - $last_seen > $site->MFILE_WWW_SESSION_EXPIRATION_TIME )
+        ? 0
+        : 1;
+}
+
+
+1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-MFILE-0.181/lib/App/MFILE.pm 
new/App-MFILE-0.182/lib/App/MFILE.pm
--- old/App-MFILE-0.181/lib/App/MFILE.pm        2016-11-05 22:33:24.000000000 
+0100
+++ new/App-MFILE-0.182/lib/App/MFILE.pm        2017-09-27 14:44:58.000000000 
+0200
@@ -52,11 +52,11 @@
 
 =head1 VERSION
 
-Version 0.181
+Version 0.182
 
 =cut
 
-our $VERSION = '0.181';
+our $VERSION = '0.182';
 
 
 


Reply via email to