Compare commits

...

55 Commits

Author SHA1 Message Date
Daniel Berteaud
2544f869c6 update spec file 2013-10-15 15:32:38 +02:00
Daniel Berteaud
3463055a23 Stop removing rights.ser file, as permissions are now handled in role.ser 2013-10-15 15:29:32 +02:00
Daniel Berteaud
c23a8e2ee8 Use the generic JSON::true and JSON::false boolean notation so it can work with JSON::XS (if installed) or JSON::PP 2013-10-15 15:28:16 +02:00
Daniel Berteaud
07206b904b update spec file 2013-10-15 15:27:22 +02:00
Daniel Berteaud
68d86c7b17 Correctly unlink lock files in indexer script 2013-10-09 10:34:59 +02:00
Daniel Berteaud
bc5240af4f Add missing File::stat module in indexer script 2013-10-09 09:19:35 +02:00
Daniel Berteaud
d79ee7acb9 Disable xsendfile for now as it doesn't work with ZIP generated by powerfs 2013-10-08 18:37:04 +02:00
Daniel Berteaud
7720210ebe Various fixes in plugins_configs.ser templates 2013-10-08 18:07:21 +02:00
Daniel Berteaud
215c091c88 Enable ckeditor 2013-10-08 16:08:00 +02:00
Daniel Berteaud
a21b08a9a4 Enable and configure the imagick editor 2013-10-08 16:07:08 +02:00
Daniel Berteaud
af046139f9 make sure the indexer lock is removed 2013-10-08 10:19:59 +02:00
Daniel Berteaud
e69ada4ee6 Fix sending indexer output to /dev/null 2013-10-08 09:45:52 +02:00
Daniel Berteaud
587ba5234d Remove the indexer lock if it's too old (> 5 hours) 2013-10-07 16:43:14 +02:00
Daniel Berteaud
23bbb41220 Grant access to the admin user on every share, regardless of the actual permissions. admin anyway already has access on the filesystem, so this just makes sure he'll have the same perms through Ajaxplorer. It's also needed for the indexer feature to work 2013-10-07 16:33:04 +02:00
Daniel Berteaud
8dced78dc7 Add an indexer cron job 2013-10-07 16:30:19 +02:00
Daniel Berteaud
714b11a2cf First try to index PDF with pdftotext, and fallback to gs if pdftotext cannot extract any usefull information 2013-10-07 08:46:39 +02:00
Daniel Berteaud
a54a1a593b Add indexing support using the lucene engine 2013-10-03 18:38:50 +02:00
Daniel Berteaud
60f81967b2 Allow everythin under /var/lib/ajaxplorer (tmp for example is also needed) 2013-10-03 12:44:51 +02:00
Daniel Berteaud
ad60e37425 Enable xsendfile to reduce CPU load when downloading big file. Also enable posix to get permissions, and probe real size 2013-10-03 12:05:40 +02:00
Daniel Berteaud
66dcd25331 Make sure output_buffering is disabled 2013-10-03 11:39:18 +02:00
Daniel Berteaud
de33bd9fbd Enable powerfs, lets use an external zip process to create archives when users download a selection of files or a folder 2013-10-03 11:27:37 +02:00
Daniel Berteaud
4827f330be Grant apache read/write access to bootstrao.json 2013-10-03 11:14:39 +02:00
Daniel Berteaud
b800430162 Use pretty JSON output in bootstrap.json templates 2013-10-03 11:13:25 +02:00
Daniel Berteaud
3d85c4fa95 Correctly remove parameters array in role files (so we can add/remove email and display name) 2013-10-03 10:48:41 +02:00
Daniel Berteaud
3c7856c549 Enable command line framework 2013-10-03 10:00:02 +02:00
Daniel Berteaud
80627c8ce4 Correctly represent boolean values in serialized data 2013-10-03 09:50:20 +02:00
Daniel Berteaud
29b3215d65 Automatically set email and display names for users 2013-10-03 09:48:37 +02:00
Daniel Berteaud
2a621eada1 Make the sql init file executable 2013-10-03 09:00:59 +02:00
Daniel Berteaud
622f8f3eac expand bootstrap.json templates 2013-10-02 19:53:28 +02:00
Daniel Berteaud
9970dfc9f4 Initialize variables in bootstrap.json templates 2013-10-02 19:52:42 +02:00
Daniel Berteaud
4b1d0517ba Fix createlinks (don't create php headers twice for bootstrap_plugins.php) 2013-10-02 19:39:02 +02:00
Daniel Berteaud
cf273d4871 Enable notifications 2013-10-02 19:35:36 +02:00
Daniel Berteaud
41305fa1e4 Enable meta.watch on repositories 2013-10-02 19:32:05 +02:00
Daniel Berteaud
aaef4c4bf4 Remove templates for bootstrap_plugins.php, and make sure this file is now empty 2013-10-02 19:30:05 +02:00
Daniel Berteaud
1a76bbcbc8 Add templates for bootstrap.json, which replace the old bootstrap_plugins.php file 2013-10-02 19:28:00 +02:00
Daniel Berteaud
7192c3dc4c Create a MySQL database, generate a random password and load the feed table structure 2013-10-02 18:55:40 +02:00
Daniel Berteaud
ec322a8b7a update spec file 2013-09-27 09:19:33 +02:00
Daniel Berteaud
faf021bf08 Update acl if they already exists, or create a default role if role.ser doesn't exists 2013-09-26 19:57:24 +02:00
Daniel Berteaud
5a10c7d865 Remove rights.ser templates, now permissions are managed in role.ser 2013-09-26 19:55:18 +02:00
Daniel Berteaud
65a287bdb4 Update role templates (they are not used but stil...) 2013-09-26 19:52:44 +02:00
Daniel Berteaud
5ca89564e8 Don't fix admin priv in the share loop 2013-09-26 19:27:21 +02:00
Daniel Berteaud
b027fe7a3e Update permissions in the role.ser file, which is where Ajaxplorer looks for permissions since v5 2013-09-26 19:25:25 +02:00
Daniel Berteaud
971e3c4abd update spec file 2013-09-10 16:25:40 +02:00
Daniel Berteaud
fc9e1b464d Lucence indexes don't really work, disbale for now 2013-07-04 10:06:21 +02:00
Daniel Berteaud
d028d3059c Unconditionaly enable meta sources and lucene index 2013-07-03 17:25:55 +02:00
Daniel Berteaud
67f7bbd7d3 Configure log plugin in conf.serial 2013-07-03 16:57:09 +02:00
Daniel Berteaud
1514276966 Purge i18n cache 2013-07-03 16:06:57 +02:00
Daniel Berteaud
887e846387 Expand templates for first_run_passed and admin_counted in webapps-update and bootstrap-console-save 2013-07-03 15:46:51 +02:00
Daniel Berteaud
4e147c271c Templates first_run_passed and admin_counted so you can easily empty the cache directory 2013-07-03 14:24:57 +02:00
Daniel Berteaud
6fb5acef41 Revert "Add first_run_passed and admin_counted files in cache dir"
This reverts commit d17bae0995.
2013-07-03 14:21:41 +02:00
Daniel Berteaud
d17bae0995 Add first_run_passed and admin_counted files in cache dir 2013-07-03 13:14:08 +02:00
Daniel Berteaud
92ce313620 Use name and desc for workspaces 2013-07-03 13:11:47 +02:00
Daniel Berteaud
8c7231eb30 Add tag metadata 2013-05-05 23:29:05 +02:00
Daniel Berteaud
d3ce3f5362 Fix ajxp_conf repo 2013-05-05 23:28:15 +02:00
Daniel Berteaud
35cfb2d0b3 update spec file 2012-11-29 16:14:47 +01:00
22 changed files with 396 additions and 147 deletions

View File

@ -4,10 +4,14 @@ 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("/var/cache/ajaxplorer/first_run_passed", qw(webapps-update bootstrap-console-save));
templates2events("/var/cache/ajaxplorer/admin_counted", qw(webapps-update bootstrap-console-save));
templates2events("/etc/e-smith/sql/init/ajaxplorer", 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("/var/lib/ajaxplorer/plugins/conf.serial/plugins_configs.ser", qw(webapps-update bootstrap-console-save));
templates2events("/var/lib/ajaxplorer/plugins/boot.conf/bootstrap.json", 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");
@ -15,6 +19,8 @@ safe_symlink("/etc/e-smith/templates-default/template-end-php", "root/etc/e-smit
safe_symlink("/etc/e-smith/templates-default/template-end-php", "root/etc/e-smith/templates/etc/ajaxplorer/bootstrap_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");
safe_touch("root/etc/e-smith/templates/var/cache/ajaxplorer/first_run_passed/template-begin");
safe_touch("root/etc/e-smith/templates/var/cache/ajaxplorer/admin_counted/template-begin");
event_link("ajaxplorer-user-rights", "webapps-update", "85");
event_link("ajaxplorer-user-rights", "share-create", "85");
@ -28,6 +34,6 @@ 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");
safe_touch("root/etc/e-smith/templates/var/lib/ajaxplorer/plugins/boot.conf/bootstrap.json/template-begin");

View File

@ -0,0 +1,44 @@
#!/usr/bin/perl -w
use strict;
use esmith::ConfigDB;
use esmith::AccountsDB;
use File::stat;
my $c = esmith::ConfigDB->open_ro || die "Couldn't open ConfigDB\n";
my $a = esmith::AccountsDB->open_ro || die "Couldn't open AccountsDB\n";
my $ajaxplorer = $c->get('ajaxplorer') || die "ajaxplorer entry is missing in the configuration database\n";
my $status = $ajaxplorer->prop('status') || 'disabled';
my $indexer = $ajaxplorer->prop('Indexer') || 'enabled';
exit(0) if ($status ne 'enabled' || $indexer ne 'enabled');
# Generate a random ID for our requests
my @chars = ('a'..'z','A..Z','0'..'9');
my $id = '';
foreach (0..32){
$id .= $chars[rand @chars];
}
foreach my $share ($a->get_all_by_prop(type => 'share')){
$ajaxplorer = $share->prop('Ajaxplorer') || 'disabled';
$indexer = $share->prop('AjaxplorerIndexer') || 'enabled';
next if ($ajaxplorer ne 'enabled' || $indexer ne 'enabled');
my $name = $share->key;
# Check if the lock file is present and if it's too old (last index crashed ?)
if (-e "/var/cache/ajaxplorer/indexes/.ajxp_lock-$name"){
my $mtime = stat("/var/cache/ajaxplorer/indexes/.ajxp_lock-$name")->mtime;
unlink </var/cache/ajaxplorer/indexes/.ajxp_lock-$name>
if (time() - $mtime > 18000);
}
system('/usr/bin/sudo -u www /usr/bin/php /usr/share/ajaxplorer/cmd.php ' .
'-u=RDiin175M40T0cYvXLARpAi+1TsSVkbksEDZ4KvwBuY= '.
'-t=e71479ebc4365176d9f09fe957780024 -a=index '.
'-r='.$name.' --secure_token='.$id.' --dir=/ --_method=put >/dev/null 2>&1');
# In some cases, the lock file is not removed, make sure it's unlocked
unlink </var/cache/ajaxplorer/indexes/.ajxp_lock-$name>;
}
# We should now restart OOo to release memory
if (-d '/var/service/ooo'){
system('/usr/bin/sv t /service/ooo');
}

View File

@ -0,0 +1 @@
ajaxplorer

View File

@ -0,0 +1 @@
ajaxplorer

View File

@ -0,0 +1,27 @@
{
my $rec = $DB->get('ajaxplorer')
|| $DB->new_record('ajaxplorer', {type => 'webapp'});
my $pw = $rec->prop('DbPassword');
if (not $pw or length($pw) < 57){
use MIME::Base64 qw(encode_base64);
$pw = "not set due to error";
if ( open( RANDOM, "/dev/urandom" ) ){
my $buf;
# 57 bytes is a full line of Base64 coding, and contains
# 456 bits of randomness - given a perfectly random /dev/random
if ( read( RANDOM, $buf, 57 ) != 57 ){
warn("Short read from /dev/random: $!");
}
else{
$pw = encode_base64($buf);
chomp $pw;
}
close RANDOM;
}
else{
warn "Could not open /dev/urandom: $!";
}
$rec->set_prop('DbPassword', $pw);
}
}

View File

@ -24,30 +24,79 @@ use esmith::templates;
use esmith::ConfigDB;
use esmith::AccountsDB;
use File::Path qw(mkpath rmtree);
use PHP::Serialization qw(serialize unserialize);
my $c = esmith::ConfigDB->open_ro;
my $a = esmith::AccountsDB->open_ro;
# Remove all the permissions
unlink(</var/lib/ajaxplorer/plugins/auth.serial/*/rights.ser>);
my $domain = $c->get('DomainName')->value;
# Remove active sessions
unlink(</var/lib/ajaxplorer/tmp/sess_*>);
# Remove plugin cache
# Remove plugin and i18n cache
unlink(</var/cache/ajaxplorer/plugin*.ser>);
unlink(</var/cache/ajaxplorer/i18n/*.ser>);
foreach my $user (($a->users),$a->get('admin')){
my $name = $user->key;
my $first = $user->prop('FirstName') || '';
my $last = $user->prop('LastName') || $name;
my $data;
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",
});
if (-s "/var/lib/ajaxplorer/plugins/auth.serial/$name/role.ser"){
open RROLE, "/var/lib/ajaxplorer/plugins/auth.serial/$name/role.ser";
$data = <RROLE>;
close RROLE;
$data = unserialize($data);
delete $data->{"\0*\0acls"} if (defined $data->{"\0*\0acls"});
}
# No role yet ? lets create it
else{
$data->{"\0*\0groupPath"} = undef;
$data->{"\0*\0autoApplies"} = [];
$data->{"\0*\0roleLabel"} = undef;
$data->{"\0*\0actions"} = [];
$data->{"\0*\0roleId"} = "AJXP_USR_/$name";
$data = bless $data, 'PHP::Serialization::Object::AJXP_Role';
}
# In any case, re-compute the effective permissions
foreach my $share ($a->get_all_by_prop(type => 'share')){
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->{"\0*\0acls"}->{$sharename} = 'r' if ( $a->is_user_in_group($name,$_) );
}
foreach (@writegroups){
$data->{"\0*\0acls"}->{$sharename} = 'rw' if ( $a->is_user_in_group($name,$_) );
}
foreach (@readusers){
$data->{"\0*\0acls"}->{$sharename} = 'r' if ( $_ eq $name );
}
foreach (@writeusers){
$data->{"\0*\0acls"}->{$sharename} = 'rw' if ( $_ eq $name );
}
# Special case: admin has access to everything
$data->{"\0*\0acls"}->{$sharename} = 'rw' if ($name eq 'admin');
}
# As we're here, lets update the email address and the display name
# First, delete parameter if it's an array (meaning it's empty)
delete $data->{"\0*\0parameters"} if (ref ($data->{"\0*\0parameters"})=~ m/ARRAY/i);
$data->{"\0*\0parameters"}->{'AJXP_REPO_SCOPE_ALL'}->{'core.conf'}->{'email'} = "$name\@$domain";
$data->{"\0*\0parameters"}->{'AJXP_REPO_SCOPE_ALL'}->{'core.conf'}->{'USER_DISPLAY_NAME'} = "$first $last";
open WROLE, '+>', "/var/lib/ajaxplorer/plugins/auth.serial/$name/role.ser";
print WROLE serialize($data);
close WROLE;
}
my $ajxp = $c->get('ajaxplorer') || die "Couldn't find ajaxplorer entry in ConfigDB\n";

View File

@ -0,0 +1 @@
PERMS=0755

View File

@ -0,0 +1,3 @@
PERMS=0660
UID="root"
GID="www"

View File

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

View File

@ -1,53 +0,0 @@
/*********************************************************/
/* 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";
\}
\}

View File

@ -43,29 +43,15 @@ foreach my $share ($a->get_all_by_prop(type=>'share')){
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",
),
"meta.filehasher" => array(),';
$OUT .=<<"EOF";
\$REPOSITORIES["$name"] = array(
"DISPLAY" => "$desc",
"DISPLAY" => "$name",
"AJXP_SLUG" => "$name",
"DRIVER" => "fs",
"DRIVER_OPTIONS" => array(
"PATH" => "/home/e-smith/files/shares/$name/files/",
"USER_DESCRIPTION" => "$desc",
"CREATE" => false,
"RECYCLE_BIN" => '$recycledir',
"CHMOD_VALUE" => '0660',
@ -73,7 +59,19 @@ foreach my $share ($a->get_all_by_prop(type=>'share')){
"PAGINATION_THRESHOLD" => 500,
"PAGINATION_NUMBER" => 200,
"META_SOURCES" => array(
$meta
"metastore.serial" => array(
"METADATA_FILE_LOCATION" => "outside",
),
"meta.user" => array (
"meta_fields" => "tags,stars_rate,css_label,anything_area",
"meta_labels" => "Tags,Rate,Type,Note",
),
"meta.filehasher" => array(),
"meta.watch" => array(),
"index.lucene" => array(
"index_content" => true,
"index_meta_fields" => 'tags,anything_area'
)
)
),
);
@ -108,7 +106,7 @@ is managed by the SME Server templates system
New repositories can be added using the smeserver-shared-folders
contrib
$REPOSITORIES[1] = array(
$REPOSITORIES["ajxp_conf"] = array(
"DISPLAY" => "Settings",
"DISPLAY_ID" => "165",
"DRIVER" => "ajxp_conf",

View File

@ -0,0 +1,46 @@
{
my $db = ${'ajaxplorer'}{'DbName'} || 'ajaxplorer';
my $user = ${'ajaxplorer'}{'DbUser'} || 'ajaxplorer';
my $pass = ${'ajaxplorer'}{'DbPassword'} || 'secret';
my $feed = "/usr/share/ajaxplorer/plugins/feed.sql/create.sql";
$OUT .= <<"END";
#! /bin/sh
if [ ! -d /var/lib/mysql/$db ]; then
/usr/bin/mysql -e 'create database $db'
/usr/bin/mysql $db < $feed
fi
/usr/bin/mysql <<EOF
USE mysql;
REPLACE INTO user (
host,
user,
password)
VALUES (
'localhost',
'$user',
PASSWORD ('$pass'));
REPLACE INTO db (
host,
db,
user,
select_priv, insert_priv, update_priv, delete_priv,
create_priv, alter_priv, index_priv, drop_priv, create_tmp_table_priv,
grant_priv, lock_tables_priv, references_priv)
VALUES (
'localhost',
'$db',
'$user',
'Y', 'Y', 'Y', 'Y',
'Y', 'Y', 'Y', 'Y', 'Y',
'N', 'Y', 'Y');
FLUSH PRIVILEGES;
EOF
END
}

View File

@ -0,0 +1,6 @@
{
if ( -e '/usr/lib64/httpd/modules/mod_xsendfile.so' ||
-e '/usr/lib/httpd/modules/mod_xsendfile.so'){
$OUT .= "LoadModule xsendfile_module modules/mod_xsendfile.so\n";
}
}

View File

@ -28,6 +28,12 @@ Alias /ajxppub /var/lib/ajaxplorer/public
<Files ".ajxp_*">
deny from all
</Files>
<IfModule mod_xsendfile.c>
XSendFile on
XSendFilePath /home/e-smith/files/shares
XSendFilePath /var/lib/ajaxplorer
XSendFilePath /home/e-smith/files/users
</IfModule>
</Directory>
EOF
@ -45,11 +51,18 @@ $alias
php_admin_value max_execution_time 900
php_admin_value upload_tmp_dir /var/lib/ajaxplorer/tmp
php_admin_value session.save_path /var/lib/ajaxplorer/tmp
php_admin_value output_buffering off
SSLRequireSSL on
Order deny,allow
Deny from all
Allow from $allow
$auth
<IfModule mod_xsendfile.c>
XSendFile on
XSendFilePath /home/e-smith/files/shares
XSendFilePath /var/lib/ajaxplorer
XSendFilePath /home/e-smith/files/users
</IfModule>
</Directory>
EOF

View File

@ -0,0 +1 @@
true

View File

@ -0,0 +1 @@
true

View File

@ -1,57 +0,0 @@
{
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 (@writeusers){
$data->{$sharename} = 'rw' if ( $_ eq $id );
}
$data->{'ajxp.admin'} = ($id eq 'admin') ? 1:0;
}
$data->{'ajxp_shared'} = 'rw'
if (($ajaxplorer{'PublicShares'} || 'enabled') eq 'enabled');
my $homedir = $ajaxplorer{'HomeDir'} || 'none';
if ($homedir eq 'enabled'){
$data->{'home'} = 'r';
}
elsif ($homedir eq 'users'){
my $acc = $a->get($id);
my $ajxphomedir = $acc->prop('AjxpHomeDir') || 'disabled';
$data->{'home'} = 'r' if ($ajxphomedir eq 'enabled');
}
# Hugly hack to convert int -> bool
my $string = serialize($data);
$string =~ s/i:/b:/;
$OUT = $string;
}

View File

@ -18,15 +18,14 @@ foreach my $group ($a->groups){
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}->{"\0*\0acls"}->{$sharename} = 'rw' if ( grep { $groupname eq $_ } @write );
$data->{$groupname}->{"\0*\0acls"}->{$sharename} = 'r' if ( grep { $groupname eq $_ } @read );
$data->{$groupname}->{"\0*\0roleId"} = $groupname;
$data->{$groupname} = bless $data->{$groupname},'PHP::Serialization::Object::AjxpRole';
$data->{$groupname} = bless $data->{$groupname},'PHP::Serialization::Object::AJXP_Role';
}
}
$OUT = serialize($data);
}

View File

@ -0,0 +1,63 @@
{
use JSON;
my $dbn = $ajaxplorer{'DbName'} || 'ajaxplorer';
my $dbu = $ajaxplorer{'DbUser'} || 'ajaxplorer';
my $dbp = $ajaxplorer{'DbPassword'} || 'secret';
my $url = $ajaxplorer{'LogoutUrl'} || '';
my $data = {
'core.conf' => {
'USERS_LIST_COMPLETE_MIN_CHARS' => '3',
'SKIP_USER_HISTORY' => JSON::true,
'DIBI_PRECONFIGURATION' => {
'mysql_username' => $dbu,
'mysql_password' => $dbp,
'mysql_driver' => 'mysql',
'group_switch_value' => 'mysql',
'mysql_database' => $dbn,
'mysql_host' => 'localhost'
},
'UNIQUE_INSTANCE_CONFIG' => {
'FAST_CHECKS' => JSON::true,
'ROLES_FILEPATH' => '/var/lib/ajaxplorer/plugins/auth.serial/roles.ser',
'USERS_DIRPATH' => '/var/lib/ajaxplorer/plugins/auth.serial',
'instance_name' => 'conf.serial',
'group_switch_value' => 'conf.serial',
'REPOSITORIES_FILEPATH' => '/var/lib/ajaxplorer/plugins/conf.serial/repo.ser'
},
'USER_CREATE_REPOSITORY' => JSON::false,
'SAVE_GUEST_PREFERENCES' => JSON::false,
'USERS_LIST_HIDE_LOGIN' => JSON::false,
'USERS_LIST_COMPLETE_LIMIT' => '20',
'ALLOW_CROSSUSERS_SHARING' => JSON::true,
},
'core.auth' => {
'MASTER_INSTANCE_CONFIG' => {
'LOGOUT_URL' => $url,
'LOGIN_REDIRECT' => '',
'instance_name' => 'auth.basic_http',
'AJXP_ADMIN_LOGIN' => '',
'TRANSMIT_CLEAR_PASS' => JSON::true,
'AUTOCREATE_AJXPUSER' => JSON::false,
'group_switch_value' => 'auth.basic_http',
'USERS_FILEPATH' => '/var/lib/ajaxplorer/plugins/auth.serial/users.ser'
},
'SLAVE_INSTANCE_CONFIG_group_switch' => '',
'SLAVE_INSTANCE_CONFIG' => [],
'SECURE_LOGIN_FORM' => JSON::false,
'SESSION_SET_CREDENTIALS' => JSON::false,
'MULTI_MODE' => {
'instance_name' => 'MASTER_SLAVE',
'group_switch_value' => 'MASTER_SLAVE'
},
'CASE_SENSITIVE' => JSON::true,
'ENABLE_USERS' => JSON::true,
'ALLOW_GUEST_BROWSING' => JSON::false,
'MULTI_USER_BASE_DRIVER' => '',
'PASSWORD_MINLENGTH' => '8'
}
};
$OUT = to_json($data, {pretty => 1});
}

View File

@ -9,12 +9,78 @@ $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';
$data->{'core.ajaxplorer'}->{'CMDLINE_ACTIVE'} = '__true__';
$data->{'core.ajaxplorer'}->{'CLI_PHP'} = '/usr/bin/php';
if (($ajaxplorer{'PublicShares'} || 'enabled') 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);
$data->{'core.log'} = {
'UNIQUE_PLUGIN_INSTANCE' => {
'LOG_FILE_NAME' => 'log_date(\'m-d-y\').txt',
'LOG_PATH' => '/var/log/ajaxplorer/',
'instance_name' => 'log.text',
'group_switch_value' => 'log.text',
'LOG_CHMOD' => 770
}
};
$data->{'access.fs'} = {
'HIDE_EXTENSIONS' => 'ser',
'PROBE_REAL_SIZE' => '__true__',
'USE_POSIX' => '__true__',
};
$data->{'core.notifications'} = {
'UNIQUE_FEED_INSTANCE' => {
'instance_name' => 'feed.sql',
'group_switch_value' => 'feed.sql',
'SQL_DRIVER' => {
'group_switch_value' => 'core',
'core_driver' => 'core'
}
},
'USER_EVENTS' => '__true__'
};
$data->{'action.powerfs'} = {
'AJXP_PLUGIN_ENABLED' => '__true__'
};
$data->{'index.lucene'} = {
'QUERY_ANALYSER' => 'utf8num_insensitive',
'AJXP_PLUGIN_ENABLED' => '__true__',
'WILDCARD_LIMITATION' => '0',
'PDFTOTEXT' => '/usr/bin/ajxppdftotext',
'PARSE_CONTENT_HTML' => 'html,htm',
'PARSE_CONTENT_TXT' => 'txt',
'PARSE_CONTENT_MAX_SIZE' => '20000000',
'UNOCONV' => '/usr/bin/unoconv --server 127.0.0.1',
'index_content' => '__true__'
};
$data->{'editor.imagick'} = {
'IM_VIEWER_QUALITY' => '90',
'AJXP_PLUGIN_ENABLED' => '__true__',
'ONTHEFLY_THRESHOLD' => '3',
'ADDITIONAL_ENV_PATH' => '',
'IM_THUMB_QUALITY' => '65',
'IMAGE_MAGICK_CONVERT' => '/usr/bin/convert',
'UNOCONV' => 'HOME=/var/cache/ooo /usr/bin/unoconv --server 127.0.0.1',
'IM_CUSTOM_OPTIONS' => '-strip'
};
$data->{'editor.ckeditor'} = {
'AJXP_PLUGIN_ENABLED' => '__true__'
};
$data = serialize($data);
# PHP::Serialization has now way to
# represent a boolean, so lets replace __true__
# manually
$data =~ s/s:8:"__true__";/b:1;/g;
$OUT = $data;
}

View File

@ -0,0 +1,6 @@
#!/bin/bash
RES=$(/usr/bin/pdftotext -eol unix -layout -nopgbrk "$1" -)
if [ -z "$RES" ]; then
RES=$(/usr/bin/gs -q -P- -dNODISPLAY -dSAFER -dDELAYBIND -dWRITESYSTEMDICT -dSIMPLE -f ps2ascii.ps "$1" -c quit 2>/dev/null | iconv -f ISO8859-1 -t UTF-8)
fi
echo "$RES"

View File

@ -2,14 +2,14 @@
# Name: Daniel Berteaud
%define name smeserver-ajaxplorer
%define version 0.1.5
%define version 0.1.10
%define release 1
Summary: sme server integration of ajaxplorer
Name: %{name}
Version: %{version}
Release: %{release}%{?dist}
License: GNU GPL version 2
URL: http://www.ajaxplorer.info/wordpress/
URL: http://www.ajaxplorer.info/
Group: SMEserver/addon
Source: %{name}-%{version}.tar.gz
@ -22,6 +22,10 @@ Requires: smeserver-webapps-common
Requires: smeserver-shared-folders >= 0.1-64
Requires: perl(PHP::Serialization)
Requires: perl(File::Path)
Requires: perl(JSON)
Requires: ghostscript
Requires: poppler-utils
#Requires: mod_xsendfile
%description
smserver integration of ajaxplorer.
@ -29,6 +33,29 @@ Ajaxplorer is a rich-client browser for managing files on a web server
This contrib works with the smeserver-shared-folders addon
%changelog
* Tue Oct 15 2013 Daniel Berteaud <daniel@firewall-services.com> 0.1.10-1
- Compatibility with JSON::XS
- Stop removing rights.ser files
* Wed Oct 2 2013 Daniel Berteaud <daniel@firewall-services.com> 0.1.9-1
- Enable notifications
- Enable cmd_line
- Enable lucene indexing
- Enable powerfs
* Thu Sep 26 2013 Daniel Berteaud <daniel@firewall-services.com> 0.1.8-1
- Correctly update the personal role, which is where Ajaxplorer
Looks for permissions now
* Wed Jul 3 2013 Daniel Berteaud <daniel@firewall-services.com> 0.1.7-1
- Compat with AjaXplorer 5
- Enable meta sources on shares
- Flush i18n cache so locales are updated
* Thu Nov 29 2012 Daniel Berteaud <daniel@firewall-services.com> 0.1.6-1
- Enable meta.filehasher if metadata is enabled
- Enable publiclets on a default install
* Mon Oct 15 2012 Daniel Berteaud <daniel@firewall-services.com> 0.1.5-1
- Add a cron task to delete old files in tmp dir
@ -98,6 +125,8 @@ rm -rf $RPM_BUILD_ROOT
rm -f %{name}-%{version}-filelist
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
--file /etc/cron.daily/ajaxplorer-tmpwatch 'attr(0755,root,root)' \
--file /etc/cron.daily/ajaxplorer-indexer 'attr(0700,root,root)' \
--file /usr/bin/ajxppdftotext 'attr(0755,root,root)' \
> %{name}-%{version}-filelist
%files -f %{name}-%{version}-filelist