aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-05-14 21:57:20 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-05-14 21:57:20 -0700
commit47564d4310da9a494cafcaba2741d6974dfcb9ce (patch)
treec2649c592bdc9191616f7323c08238df580268d9
parentf866a42a42b9e12756353f5bb39a0f31a64bb26a (diff)
downloadvolse-hubzilla-47564d4310da9a494cafcaba2741d6974dfcb9ce.tar.gz
volse-hubzilla-47564d4310da9a494cafcaba2741d6974dfcb9ce.tar.bz2
volse-hubzilla-47564d4310da9a494cafcaba2741d6974dfcb9ce.zip
provide default permissions ('all') for existing and newly created OAuth app clients, which will be extended in the future to allow specific permissions.
-rwxr-xr-xboot.php2
-rw-r--r--install/update.php25
-rw-r--r--mod/settings.php25
-rw-r--r--version.inc2
4 files changed, 40 insertions, 14 deletions
diff --git a/boot.php b/boot.php
index a12527a2c..ac66c6b4e 100755
--- a/boot.php
+++ b/boot.php
@@ -49,7 +49,7 @@ define ( 'PLATFORM_NAME', 'redmatrix' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 );
-define ( 'DB_UPDATE_VERSION', 1140 );
+define ( 'DB_UPDATE_VERSION', 1141 );
/**
* @brief Constant with a HTML line break.
diff --git a/install/update.php b/install/update.php
index 36aa20373..13dd004c9 100644
--- a/install/update.php
+++ b/install/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1140 );
+define( 'UPDATE_VERSION' , 1141 );
/**
*
@@ -1602,4 +1602,25 @@ function update_r1139() {
return UPDATE_SUCCESS;
return UPDATE_FAILED;
-} \ No newline at end of file
+}
+
+function update_r1140() {
+ $r = q("select * from clients where true");
+ $x = false;
+ if($r) {
+ foreach($r as $rr) {
+ $m = q("INSERT INTO xperm (xp_client, xp_channel, xp_perm) VALUES ('%s', %d, '%s') ",
+ dbesc($rr['client_id']),
+ intval($rr['uid']),
+ dbesc('all')
+ );
+ if(! $m)
+ $x = true;
+ }
+ }
+ if($x)
+ return UPDATE_FAILED;
+ return UPDATE_SUCCESS;
+}
+
+
diff --git a/mod/settings.php b/mod/settings.php
index 56949f9d4..0cb7992ed 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -95,18 +95,23 @@ function settings_post(&$a) {
dbesc($name),
dbesc($redirect),
dbesc($icon),
- local_channel(),
+ intval(local_channel()),
dbesc($key));
} else {
- $r = q("INSERT INTO clients
- (client_id, pw, name, redirect_uri, icon, uid)
- VALUES ('%s','%s','%s','%s','%s',%d)",
- dbesc($key),
- dbesc($secret),
- dbesc($name),
- dbesc($redirect),
- dbesc($icon),
- local_channel());
+ $r = q("INSERT INTO clients (client_id, pw, name, redirect_uri, icon, uid)
+ VALUES ('%s','%s','%s','%s','%s',%d)",
+ dbesc($key),
+ dbesc($secret),
+ dbesc($name),
+ dbesc($redirect),
+ dbesc($icon),
+ intval(local_channel())
+ );
+ $r = q("INSERT INTO xperm (xp_client, xp_channel, xp_perm) VALUES ('%s', %d, '%s') ",
+ dbesc($key),
+ intval(local_channel()),
+ dbesc('all')
+ );
}
}
goaway($a->get_baseurl(true)."/settings/oauth/");
diff --git a/version.inc b/version.inc
index 4e843c8e9..b4af2b2ab 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2015-05-13.1031
+2015-05-14.1032