initial commit

tags/0.1.1
Daniel Berteaud 13 years ago
commit 82e6798781
  1. 34
      createlinks
  2. 1
      root/etc/e-smith/accounts/defaults/ajaxplorer/type
  3. 1
      root/etc/e-smith/db/configuration/defaults/ajaxplorer/access
  4. 1
      root/etc/e-smith/db/configuration/defaults/ajaxplorer/status
  5. 1
      root/etc/e-smith/db/configuration/defaults/ajaxplorer/type
  6. 50
      root/etc/e-smith/events/actions/ajaxplorer-user-rights
  7. 4
      root/etc/e-smith/templates.metadata/var/lib/ajaxplorer/plugins/auth.serial/__user__/rights.ser
  8. 4
      root/etc/e-smith/templates.metadata/var/lib/ajaxplorer/plugins/auth.serial/roles.ser
  9. 4
      root/etc/e-smith/templates.metadata/var/lib/ajaxplorer/plugins/auth.serial/users.ser
  10. 4
      root/etc/e-smith/templates.metadata/var/lib/ajaxplorer/plugins/conf.serial/plugins_configs.ser
  11. 1
      root/etc/e-smith/templates/etc/ajaxplorer/bootstrap_plugins.php/001exec
  12. 53
      root/etc/e-smith/templates/etc/ajaxplorer/bootstrap_plugins.php/040plugins
  13. 1
      root/etc/e-smith/templates/etc/ajaxplorer/bootstrap_repositories.php/001exec
  14. 92
      root/etc/e-smith/templates/etc/ajaxplorer/bootstrap_repositories.php/050repo
  15. 73
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98Ajaxplorer
  16. 14
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/60AjaxplorerSSL
  17. 46
      root/etc/e-smith/templates/var/lib/ajaxplorer/plugins/auth.serial/__user__/rights.ser/10All
  18. 32
      root/etc/e-smith/templates/var/lib/ajaxplorer/plugins/auth.serial/roles.ser/10All
  19. 16
      root/etc/e-smith/templates/var/lib/ajaxplorer/plugins/auth.serial/users.ser/10All
  20. 20
      root/etc/e-smith/templates/var/lib/ajaxplorer/plugins/conf.serial/plugins_configs.ser/10All
  21. 96
      smeserver-ajaxplorer.spec

@ -0,0 +1,34 @@
#!/usr/bin/perl -w
use esmith::Build::CreateLinks qw(:all);
templates2events("/etc/ajaxplorer/bootstrap_plugins.php", qw(webapps-update bootstrap-console-save));
templates2events("/var/cache/ajaxplorer/diag_result.php", qw(webapps-update bootstrap-console-save));
templates2events("/etc/ajaxplorer/bootstrap_repositories.php", qw(webapps-update bootstrap-console-save share-create share-delete share-modify share-modify-servers));
templates2events("/var/lib/ajaxplorer/plugins/auth.serial/roles.ser", qw(webapps-update bootstrap-console-save share-create share-delete share-modify share-modify-servers));
templates2events("/var/lib/ajaxplorer/plugins/auth.serial/users.ser", qw(webapps-update bootstrap-console-save user-create user-delete));
templates2events("/etc/ajaxplorer/diag_result.php", qw(webapps-update bootstrap-console-save));
templates2events("/var/lib/ajaxplorer/plugins/conf.serial/plugins_configs.ser", qw(webapps-update bootstrap-console-save));
safe_symlink("/etc/e-smith/templates-default/template-begin-php", "root/etc/e-smith/templates/etc/ajaxplorer/bootstrap_plugins.php/template-begin");
safe_symlink("/etc/e-smith/templates-default/template-begin-php", "root/etc/e-smith/templates/etc/ajaxplorer/bootstrap_repositories.php/template-begin");
safe_symlink("/etc/e-smith/templates-default/template-end-php", "root/etc/e-smith/templates/etc/ajaxplorer/boostrap_plugins.php/template-end");
safe_symlink("/etc/e-smith/templates-default/template-end-php", "root/etc/e-smith/templates/etc/ajaxplorer/boostrap_repositories.php/template-end");
safe_symlink("/etc/e-smith/templates-default/template-begin-php", "root/etc/e-smith/templates/var/cache/ajaxplorer/diag_result.php/template-begin");
safe_symlink("/etc/e-smith/templates-default/template-end-php", "root/etc/e-smith/templates/var/cache/ajaxplorer/diag_result.php/template-end");
event_link("ajaxplorer-user-rights", "webapps-update", "85");
event_link("ajaxplorer-user-rights", "share-create", "85");
event_link("ajaxplorer-user-rights", "share-delete", "85");
event_link("ajaxplorer-user-rights", "share-modify", "85");
event_link("ajaxplorer-user-rights", "share-modify-servers", "85");
event_link("ajaxplorer-user-rights", "user-delete", "85");
event_link("ajaxplorer-user-rights", "group-create", "85");
event_link("ajaxplorer-user-rights", "group-modify", "85");
event_link("ajaxplorer-user-rights", "group-delete", "85");
event_link("ajaxplorer-user-rights", "user-modify-admin", "85");
safe_touch("root/etc/e-smith/templates/var/lib/ajaxplorer/plugins/auth.serial/roles.ser/template-begin");
safe_touch("root/etc/e-smith/templates/var/lib/ajaxplorer/plugins/auth.serial/__user__/rights.ser/template-begin");
safe_touch("root/etc/e-smith/templates/var/lib/ajaxplorer/plugins/auth.serial/users.ser/template-begin");
safe_touch("root/etc/e-smith/templates/var/lib/ajaxplorer/plugins/conf.serial/plugins_configs.ser/template-begin");

@ -0,0 +1,50 @@
#!/usr/bin/perl -w
#----------------------------------------------------------------------
# copyright (C) 2011-2012 Firewall Services
# Daniel Berteaud <daniel@firewall-services.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#----------------------------------------------------------------------
use strict;
use esmith::templates;
use esmith::AccountsDB;
use File::Path qw(mkpath rmtree);
my $a = esmith::AccountsDB->open_ro;
# Remove all the permissions
unlink(</var/lib/ajaxplorer/plugins/auth.serial/*/rights.ser>);
# Remove active sessions
unlink(</var/lib/ajaxplorer/tmp/sess_*>);
# Remove plugin cache
unlink(</var/cache/ajaxplorer/plugin*.ser>);
foreach my $user (($a->users),$a->get('admin')){
my $name = $user->key;
mkpath('/var/lib/ajaxplorer/plugins/auth.serial/' . $name);
chmod 0770, "/var/lib/ajaxplorer/plugins/auth.serial/$name";
chown '0', '102', "/var/lib/ajaxplorer/plugins/auth.serial/$name";
processTemplate(
{
TEMPLATE_PATH => "/var/lib/ajaxplorer/plugins/auth.serial/__user__/rights.ser",
MORE_DATA => {KEY=>$name},
OUTPUT_FILENAME => "/var/lib/ajaxplorer/plugins/auth.serial/$name/rights.ser",
});
}

@ -0,0 +1 @@
defined('AJXP_EXEC') or die( 'Access not allowed');

@ -0,0 +1,53 @@
/*********************************************************/
/* PLUGINS DEFINITIONS
/* Drivers will define how the application will work. For
/* each type of operation, there are multiple implementation
/* possible. Check the content of the plugins folder.
/* CONF = users and repositories definition,
/* AUTH = users authentification mechanism,
/* LOG = logs of the application.
/*
/* By default, the three are all based on files.
/*
/* ACTIVE_PLUGINS adds other type of plugins to the application.
/* If you are developping your own plugin, do not forget to declare
/* it here.
/*********************************************************/
$PLUGINS = array(
"CONF_DRIVER" => array(
"NAME" => "serial",
"OPTIONS" => array(
"REPOSITORIES_FILEPATH" => "/var/lib/ajaxplorer/plugins/conf.serial/repo.ser",
"ROLES_FILEPATH" => "/var/lib/ajaxplorer/plugins/auth.serial/roles.ser",
"USERS_DIRPATH" => "/var/lib/ajaxplorer/plugins/auth.serial",
)
),
"AUTH_DRIVER" => array(
"NAME" => "basic_http",
"OPTIONS" => array(
"LOGIN_REDIRECT" => false,
"USERS_FILEPATH" => "/var/lib/ajaxplorer/plugins/auth.serial/users.ser",
"AUTOCREATE_AJXPUSER" => false,
"TRANSMIT_CLEAR_PASS" => false,
"LOGOUT_URL" => "{$ajaxplorer{'LogoutUrl'} || 'http://' . $SystemName . '.' . $DomainName;}" )
),
"LOG_DRIVER" => array(
"NAME" => "text",
"OPTIONS" => array(
"LOG_PATH" => "/var/log/ajaxplorer/",
"LOG_FILE_NAME" => 'log_' . date('m-d-y') . '.txt',
"LOG_CHMOD" => 0770
)
),
// Do not use wildcard for uploader, to keep them in a given order
// Warning, do not add the "meta." plugins, they are automatically
// detected and activated by the application.
"ACTIVE_PLUGINS" => array("editor.*", "uploader.flex", "uploader.html", "gui.ajax", "hook.*")
);
if(AJXP_Utils::userAgentIsMobile())\{
$PLUGINS["ACTIVE_PLUGINS"][] = "gui.mobile";
if(AJXP_Utils::userAgentIsIOS() && !isSet($_GET["skipIOS"]) && !isSet($_COOKIE["SKIP_IOS"]))\{
$PLUGINS["ACTIVE_PLUGINS"][] = "gui.ios";
\}
\}

@ -0,0 +1 @@
defined('AJXP_EXEC') or die( 'Access not allowed');

@ -0,0 +1,92 @@
/*********************************************************/
/* BASIC REPOSITORY CONFIGURATION.
/* To add a repository, create a new shared-folders and choose
/* the access with web-based management interface
/*********************************************************/
{
use esmith::AccountsDB;
my $a = esmith::AccountsDB->open_ro();
foreach my $share ($a->get_all_by_prop(type=>'share')){
my $name = $share->key;
my $access = $share->prop('Ajaxplorer') || 'disabled';
next unless ($access eq 'enabled');
my $desc = $share->prop('Name') || $name;
my $recycledir = (($share->prop('RecycleBin') || 'disabled') eq 'disabled') ?
'' : $share->prop('RecycleBinDir') || 'Recycle Bin';
my $meta = (($share->prop('AjaxplorerIndex') || 'disabled') eq 'disabled') ?
'' : '"index.lucene" => array(
"index_content" => "1",
"index_meta_fields" => "anything_area",
"repository_specific_keywords" => ""
),' . "\n ";
$meta .= (($share->prop('AjaxplorerMetadata') || 'disabled') eq 'disabled') ?
'' : '"metastore.serial" => array(
"METADATA_FILE_LOCATION" => "outside",
),
"meta.user" => array (
"meta_fields" => "stars_rate,css_label,anything_area",
"meta_labels" => "Rate,Type,Note",
),';
$OUT .=<<"EOF";
\$REPOSITORIES["$name"] = array(
"DISPLAY" => "$desc",
"AJXP_SLUG" => "$name",
"DRIVER" => "fs",
"DRIVER_OPTIONS" => array(
"PATH" => "/home/e-smith/files/shares/$name/files/",
"CREATE" => false,
"RECYCLE_BIN" => '$recycledir',
"CHMOD_VALUE" => '0660',
"DEFAULT_RIGHTS" => "",
"PAGINATION_THRESHOLD" => 500,
"PAGINATION_NUMBER" => 200,
"META_SOURCES" => array(
$meta
)
),
);
EOF
}
if (($ajaxplorer{'PublicShares'} || 'disabled') eq 'enabled'){
$OUT .=<<'EOF';
$REPOSITORIES["ajxp_shared"] = array(
"DISPLAY" => "Shared Elements",
"DISPLAY_ID" => "363",
"DRIVER" => "ajxp_shared",
"DRIVER_OPTIONS"=> array(
"DEFAULT_RIGHTS" => ""
)
);
EOF
}
$OUT .=<<'EOF';
// ADMIN REPOSITORY
/*
Settings interface is disabled because the configuration
is managed by the SME Server templates system
New repositories can be added using the smeserver-shared-folders
contrib
$REPOSITORIES[1] = array(
"DISPLAY" => "Settings",
"DISPLAY_ID" => "165",
"DRIVER" => "ajxp_conf",
"DRIVER_OPTIONS"=> array()
);
*/
EOF
}

@ -0,0 +1,73 @@
{
use esmith::AccountsDB;
my $a = esmith::AccountsDB->open_ro;
if (($ajaxplorer{'status'} || 'disabled') eq 'enabled'){
my $alias = (($ajaxplorer{'AliasOnPrimary'} || 'enabled') eq 'enabled' ) ? 'Alias /ajaxplorer /usr/share/ajaxplorer':'';
my $allow = (($ajaxplorer{'access'} || 'private') eq 'public') ? 'all':"$localAccess $externalSSLAccess";
my $auth = (($ajaxplorer{'Authentication'} || 'http') eq 'http') ? "AuthName \"Ajaxplorer\"\n" .
" AuthType Basic\n" .
" AuthExternal pwauth\n" .
" Require valid-user\n" : '';
my $maxsize = $ajaxplorer{'MaxUploadSize'} || '200M';
my $shares = '';
foreach my $share ($a->get_all_by_prop(type=>'share')){
my $name = $share->key;
my $access = $share->prop('Ajaxplorer') || 'disabled';
$shares .= ":/home/e-smith/files/shares/$name/files" if ($access eq 'enabled');
}
my $public = $ajaxplorer{'PublicShares'} || 'disabled';
$OUT .=<<"EOF" if ($public eq 'enabled');
Alias /ajxppub /var/lib/ajaxplorer/public
<Directory /var/lib/ajaxplorer/public>
Options None
AddType application/x-httpd-php .php
php_admin_value open_basedir /usr/share/ajaxplorer:/var/lib/ajaxplorer:/var/log/ajaxplorer:/etc/ajaxplorer:/var/cache/ajaxplorer:/usr/share/pear/$shares
Order deny,allow
Allow from all
<Files ".ajxp_*">
deny from all
</Files>
</Directory>
EOF
$OUT .=<<"EOF";
$alias
<Directory /usr/share/ajaxplorer>
AddType application/x-httpd-php .php
php_admin_value open_basedir /usr/share/ajaxplorer:/var/lib/ajaxplorer:/var/log/ajaxplorer:/etc/ajaxplorer:/var/cache/ajaxplorer:/usr/share/pear/$shares
php_admin_value memory_limit 100M
php_admin_value upload_max_filesize $maxsize
php_admin_value post_max_size $maxsize
php_admin_value max_execution_time 86400
php_admin_value upload_tmp_dir /var/lib/ajaxplorer/tmp
php_admin_value session.save_path /var/lib/ajaxplorer/tmp
SSLRequireSSL on
Order deny,allow
Deny from all
Allow from $allow
$auth
</Directory>
EOF
}
else {
$OUT .=<<'EOF';
# Ajaxplorer is disabled
# You can enable it with
# db configuration setprop ajaxplorer status enabled
# signal-event webapps-update
EOF
}
}

@ -0,0 +1,14 @@
{
my $sslport = $modSSL{'TCPPort'} || '443';
my $status = $ajaxplorer{'status'} || 'enabled';
my $alias = $ajaxplorer{'AliasOnPrimary'} || 'enabled';
if (($port ne $sslport) && ($status eq 'enabled') && ($alias eq 'enabled')){
## Redirect Web Address to Secure Address
$OUT .= " RewriteEngine on\n";
$OUT .= " RewriteRule ^/ajaxplorer(/.*|\$) https://%{HTTP_HOST}/ajaxplorer\$1 \[L,R\]\n";
}
}

@ -0,0 +1,46 @@
{
use PHP::Serialization qw(serialize);
use esmith::AccountsDB;
my $a = esmith::AccountsDB->open_ro || die "Error opening accounts db\n";
my @s = $a->get_all_by_prop( type => 'share' );
my $data;
my $id = $KEY;
foreach my $share (@s){
my $sharename = $share->key;
my $access = $share->prop('Ajaxplorer') || 'disabled';
next unless ($access eq 'enabled');
my @readgroups = split(/[;,]/, $share->prop('ReadGroups') || '');
my @writegroups = split(/[;,]/, $share->prop('WriteGroups') || '');
my @readusers = split(/[;,]/, $share->prop('ReadUsers') || '');
my @writeusers = split(/[;,]/, $share->prop('WriteUsers') || '');
foreach (@readgroups){
$data->{$sharename} = 'r' if ( $a->is_user_in_group($id,$_) );
}
foreach (@writegroups){
$data->{$sharename} = 'rw' if ( $a->is_user_in_group($id,$_) );
}
foreach (@readusers){
$data->{$sharename} = 'r' if ( $_ eq $id );
}
foreach (@writegroups){
$data->{$sharename} = 'rw' if ( $_ eq $id );
}
$data->{'ajxp.admin'} = ($id eq 'admin') ? 1:0;
}
$data->{'ajxp_shared'} = 'rw'
if (($ajaxplorer{'PublicShares'} || 'disabled') eq 'enabled');
# Hugly hack to convert int -> bool
my $string = serialize($data);
$string =~ s/i:/b:/;
$OUT = $string;
}

@ -0,0 +1,32 @@
{
use PHP::Serialization qw(serialize);
use esmith::AccountsDB;
my $a = esmith::AccountsDB->open_ro || die "Error opening accounts db\n";
my @s = $a->get_all_by_prop( type => 'share' );
my $data;
foreach my $group ($a->groups){
my $groupname = $group->key;
foreach my $share (@s){
my $sharename = $share->key;
my $access = $share->prop('Ajaxplorer') || 'disabled';
next unless ($access eq 'enabled');
my @read = split(/[;,]/, $share->prop('ReadGroups') || '');
my @write = split(/[;,]/, $share->prop('WriteGroups') || '');
$data->{$groupname}->{"\00AjxpRole\00rights"}{$sharename} = 'rw' if ( grep { $groupname eq $_ } @write );
$data->{$groupname}->{"\00AjxpRole\00rights"}{$sharename} = 'r' if ( grep { $groupname eq $_ } @read );
$data->{$groupname}->{"\00AjxpRole\00id"} = $groupname;
$data->{$groupname} = bless $data->{$groupname},'PHP::Serialization::Object::AjxpRole';
}
}
$OUT = serialize($data);
}

@ -0,0 +1,16 @@
{
use PHP::Serialization qw(serialize);
use esmith::AccountsDB;
my $a = esmith::AccountsDB->open_ro || die "Error opening accounts db\n";
my $data;
foreach my $user ($a->users,$a->get('admin')){
my $key = $user->key;
$data->{$key} = $key;
}
$OUT .= serialize($data);
}

@ -0,0 +1,20 @@
{
use PHP::Serialization qw(serialize);
my $data;
$data->{'core.uploader'}->{'UPLOAD_MAX_SIZE'} = "0";
$data->{'core.uploader'}->{'UPLOAD_MAX_NUMBER'} = "50";
$data->{'gui.ajax'}->{'CUSTOM_WELCOME_MESSAGE'} = $ajaxplorer{'WelcomMessage'} || 'Ajaxplorer';
$data->{'core.ajaxplorer'}->{'WEBMASTER_EMAIL'} = 'admin@'.$DomainName;
$data->{'core.ajaxplorer'}->{'AJXP_TMP_DIR'} = '/var/lib/ajaxplorer/tmp';
$data->{'core.ajaxplorer'}->{'DEFAULT_LANGUAGE'} = $ajaxplorer{'DefaultLanguage'} || 'en';
$data->{'core.ajaxplorer'}->{'APPLICATION_TITLE'} = $ajaxplorer{'Title'} || 'Ajaxplorer';
if (($ajaxplorer{'PublicShares'} || 'disabled') eq 'enabled'){
$data->{'core.ajaxplorer'}->{'PUBLIC_DOWNLOAD_FOLDER'} = '/var/lib/ajaxplorer/public';
$data->{'core.ajaxplorer'}->{'PUBLIC_DOWNLOAD_URL'} = $ajaxplorer{'PublicDownloadUrl'} || "http://$SystemName.$DomainName/ajxppub";
}
$OUT = serialize($data);
}

@ -0,0 +1,96 @@
# Authority: vip-ire
# Name: Daniel Berteaud
%define name smeserver-ajaxplorer
%define version 0.1.1
%define release 11
Summary: sme server integration of ajaxplorer
Name: %{name}
Version: %{version}
Release: %{release}%{?dist}
License: GNU GPL version 2
URL: http://www.ajaxplorer.info/wordpress/
Group: SMEserver/addon
Source: %{name}-%{version}.tar.gz
BuildArchitectures: noarch
BuildRequires: e-smith-devtools
BuildRoot: /var/tmp/%{name}-%{version}
Requires: e-smith-base >= 5.2.0-56
Requires: ajaxplorer >= 4.0.0
Requires: smeserver-webapps-common
Requires: smeserver-shared-folders >= 0.1-64
Requires: perl(PHP::Serialization)
Requires: perl(File::Path)
%description
smserver integration of ajaxplorer.
Ajaxplorer is a rich-client browser for managing files on a web server
This contrib works with the smeserver-shared-folders addon
%changelog
* Fri Apr 06 2012 Daniel Berteaud <daniel@firewall-services.com> 0.1.1-1
- Migrate to GIT
- make all shares accessible with open_basedir
* Sat Feb 18 2012 Daniel Berteaud <daniel@firewall-services.com> 0.1-11
- Support user level ACL
* Tue Jan 03 2012 Daniel Berteaud <daniel@firewall-services.com> 0.1-10
- Ajaxplorer 4.0 compatibility
- Support publiclets
* Tue Dec 06 2011 Daniel Berteaud <daniel@firewall-services.com> 0.1-9
- turn on JS debug (IE doesn't like compacted JS)
* Mon Dec 05 2011 Daniel Berteaud <daniel@firewall-services.com> 0.1-8
- Rise upload_max_number to 50
* Wed Nov 23 2011 Daniel Berteaud <daniel@firewall-services.com> 0.1-7
- Allow access to /usr/share/pear and to /usr/share/doc/ajaxplorer-*/client
- Warn the user after 10min of inactivity (instead of 3)
- Add support for logout URL
- Remove plugin cache files on updates
- Add support for meta.serial
* Thu Nov 03 2011 Daniel Berteaud <daniel@firewall-services.com> 0.1-6
- Fix default Recycle Bin dir
* Thu Oct 27 2011 Daniel Berteaud <daniel@firewall-services.com> 0.1-5
- Flush active sessions on privileges updates
* Mon Jul 11 2011 Daniel Berteaud <daniel@firewall-services.com> 0.1-4
- Reserve /ajaxplorer location
* Tue Jul 05 2011 Daniel B. <daniel@firewall-services.com> 0.1-3
- Honor Recycle Bin settings
* Tue Jun 28 2011 Daniel B. <daniel@firewall-services.com> 0.1-2
- Call ajaxplorer-user-rights later
- Fix display name of repositories
* Fri Jun 24 2011 Daniel B. <daniel@firewall-services.com> 0.1-1
- initial release
%prep
%setup
%build
perl ./createlinks
%install
rm -rf $RPM_BUILD_ROOT
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
rm -f %{name}-%{version}-filelist
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
> %{name}-%{version}-filelist
%files -f %{name}-%{version}-filelist
%defattr(-,root,root)
%clean
rm -rf $RPM_BUILD_ROOT
%postun
Loading…
Cancel
Save