From 47564d4310da9a494cafcaba2741d6974dfcb9ce Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 14 May 2015 21:57:20 -0700 Subject: provide default permissions ('all') for existing and newly created OAuth app clients, which will be extended in the future to allow specific permissions. --- mod/settings.php | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'mod') 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/"); -- cgit v1.2.3