aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-12-22 03:33:12 -0800
committerfriendica <info@friendica.com>2012-12-22 03:33:12 -0800
commitf09b9f1e446ff005a19c451efccbd8b3806ef5f9 (patch)
tree2190b0ccfbb1075be7b0031f597fefdef3981688
parent8d71fe91f67eeb501efd6fedd17992c12882daeb (diff)
downloadvolse-hubzilla-f09b9f1e446ff005a19c451efccbd8b3806ef5f9.tar.gz
volse-hubzilla-f09b9f1e446ff005a19c451efccbd8b3806ef5f9.tar.bz2
volse-hubzilla-f09b9f1e446ff005a19c451efccbd8b3806ef5f9.zip
add permission controls to "storage" objects such as attachments or other stored files
-rw-r--r--boot.php5
-rw-r--r--include/permissions.php3
-rw-r--r--install/database.sql6
-rw-r--r--install/update.php13
-rw-r--r--mod/settings.php2
-rw-r--r--version.inc2
-rw-r--r--view/js/mod_connections.js1
7 files changed, 27 insertions, 5 deletions
diff --git a/boot.php b/boot.php
index 0405948c9..01b8c7dd1 100644
--- a/boot.php
+++ b/boot.php
@@ -16,7 +16,7 @@ require_once('include/features.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica Red');
define ( 'FRIENDICA_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 );
-define ( 'DB_UPDATE_VERSION', 1007 );
+define ( 'DB_UPDATE_VERSION', 1008 );
define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
@@ -190,6 +190,9 @@ define ( 'PERMS_W_PHOTOS', 0x0200);
define ( 'PERMS_W_CHAT', 0x0400);
define ( 'PERMS_A_DELEGATE', 0x0800);
+define ( 'PERMS_R_STORAGE', 0x1000);
+define ( 'PERMS_W_STORAGE', 0x2000);
+
// General channel permissions
diff --git a/include/permissions.php b/include/permissions.php
index 8e0594492..e74486a06 100644
--- a/include/permissions.php
+++ b/include/permissions.php
@@ -14,6 +14,7 @@ function get_perms() {
'view_profile' => array('channel_r_profile', intval(PERMS_R_PROFILE), true, t('Can view my "public" channel profile'), ''),
'view_photos' => array('channel_r_photos', intval(PERMS_R_PHOTOS), true, t('Can view my "public" photo albums'), ''),
'view_contacts' => array('channel_r_abook', intval(PERMS_R_ABOOK), true, t('Can view my "public" address book'), ''),
+ 'view_storage' => array('channel_r_storage', intval(PERMS_R_STORAGE), true, t('Can view my "public" file storage'), ''),
// Write permissions
'send_stream' => array('channel_w_stream', intval(PERMS_W_STREAM), false, t('Can send me their channel stream and posts'), ''),
@@ -23,6 +24,8 @@ function get_perms() {
'post_photos' => array('channel_w_photos', intval(PERMS_W_PHOTOS), false, t('Can post photos to my photo albums'), ''),
'tag_deliver' => array('channel_w_tagwall', intval(PERMS_W_TAGWALL), false, t('Can forward to all my channel contacts via post tags'), t('Advanced - useful for creating group forum channels')),
'chat' => array('channel_w_chat', intval(PERMS_W_CHAT), false, t('Can chat with me (when available)'), t('Requires compatible chat plugin')),
+ 'write_storage' => array('channel_w_storage', intval(PERMS_W_STORAGE), false, t('Can write to my "public" file storage'), ''),
+
'delegate' => array('channel_a_delegate', intval(PERMS_A_DELEGATE), false, t('Can administer my channel resources'), t('Extremely advanced. Leave this alone unless you know what you are doing')),
);
return $global_perms;
diff --git a/install/database.sql b/install/database.sql
index 187c3dcf5..5581a27c6 100644
--- a/install/database.sql
+++ b/install/database.sql
@@ -159,6 +159,8 @@ CREATE TABLE IF NOT EXISTS `channel` (
`channel_w_photos` tinyint(3) unsigned NOT NULL DEFAULT '128',
`channel_w_chat` tinyint(3) unsigned NOT NULL DEFAULT '128',
`channel_a_delegate` tinyint(3) unsigned NOT NULL DEFAULT '0',
+ `channel_r_storage` int(10) unsigned NOT NULL DEFAULT '128',
+ `channel_w_storage` int(10) unsigned NOT NULL DEFAULT '128',
PRIMARY KEY (`channel_id`),
KEY `channel_account_id` (`channel_account_id`),
KEY `channel_primary` (`channel_primary`),
@@ -186,7 +188,9 @@ CREATE TABLE IF NOT EXISTS `channel` (
KEY `channel_guid` (`channel_guid`),
KEY `channel_hash` (`channel_hash`),
KEY `channel_expire_days` (`channel_expire_days`),
- KEY `channel_a_delegate` (`channel_a_delegate`)
+ KEY `channel_a_delegate` (`channel_a_delegate`),
+ KEY `channel_r_storage` (`channel_r_storage`),
+ KEY `channel_w_storage` (`channel_w_storage`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `clients` (
diff --git a/install/update.php b/install/update.php
index 791371ec1..bdd687fb3 100644
--- a/install/update.php
+++ b/install/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1007 );
+define( 'UPDATE_VERSION' , 1008 );
/**
*
@@ -142,4 +142,13 @@ function update_r1006() {
if($r && $r2)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
-} \ No newline at end of file
+}
+
+
+function update_r1007() {
+ $r = q("ALTER TABLE `channel` ADD `channel_r_storage` INT UNSIGNED NOT NULL DEFAULT '128', ADD `channel_w_storage` INT UNSIGNED NOT NULL DEFAULT '128', add index ( channel_r_storage ), add index ( channel_w_storage )");
+
+ if($r && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
diff --git a/mod/settings.php b/mod/settings.php
index 060258058..2409c2eca 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -340,6 +340,8 @@ function settings_post(&$a) {
$arr['channel_w_photos'] = (($_POST['post_photos']) ? $_POST['post_photos'] : 0);
$arr['channel_w_chat'] = (($_POST['chat']) ? $_POST['chat'] : 0);
$arr['channel_a_delegate'] = (($_POST['delegate']) ? $_POST['delegate'] : 0);
+ $arr['channel_r_storage'] = (($_POST['view_storage']) ? $_POST['view_storage'] : 0);
+ $arr['channel_w_storage'] = (($_POST['write_storage']) ? $_POST['write_storage'] : 0);
$notify = 0;
diff --git a/version.inc b/version.inc
index bcf46f5cf..55ac32e24 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2012-12-20.175
+2012-12-21.176
diff --git a/view/js/mod_connections.js b/view/js/mod_connections.js
index cb4badff5..7fb38b56e 100644
--- a/view/js/mod_connections.js
+++ b/view/js/mod_connections.js
@@ -31,6 +31,7 @@ function connectFullShare() {
$('#me_id_perms_post_comments').attr('checked','checked');
$('#me_id_perms_post_mail').attr('checked','checked');
$('#me_id_perms_chat').attr('checked','checked');
+ $('#me_id_perms_view_storage').attr('checked','checked');
}