From d677b765b2a55e8e94556f3a55a4d70a26088ac4 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Thu, 9 May 2013 10:23:24 -0700 Subject: [PATCH] Renamed scopes.key to scopes.scope. Updated ScopeInterface and PDO/Scope. Fixes #45 --- sql/mysql.sql | 12 ++++++------ src/League/OAuth2/Server/Storage/PDO/Scope.php | 4 ++-- src/League/OAuth2/Server/Storage/ScopeInterface.php | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sql/mysql.sql b/sql/mysql.sql index ca03ac18..e66b2205 100644 --- a/sql/mysql.sql +++ b/sql/mysql.sql @@ -65,13 +65,13 @@ CREATE TABLE `oauth_session_refresh_tokens` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `oauth_scopes` ( - `id` SMALLINT(5) UNSIGNED NOT NULL AUTO_INCREMENT, - `key` VARCHAR(255) NOT NULL, - `name` VARCHAR(255) NOT NULL, - `description` VARCHAR(255) DEFAULT NULL, + `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, + `scope` varchar(255) NOT NULL, + `name` varchar(255) NOT NULL, + `description` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), - UNIQUE KEY `u_oasc_sc` (`key`) -) ENGINE=INNODB DEFAULT CHARSET=utf8; + UNIQUE KEY `u_oasc_sc` (`scope_key`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `oauth_session_token_scopes` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, diff --git a/src/League/OAuth2/Server/Storage/PDO/Scope.php b/src/League/OAuth2/Server/Storage/PDO/Scope.php index 19b27ec5..0c3d4ec9 100644 --- a/src/League/OAuth2/Server/Storage/PDO/Scope.php +++ b/src/League/OAuth2/Server/Storage/PDO/Scope.php @@ -10,7 +10,7 @@ class Scope implements ScopeInterface { $db = \ezcDbInstance::get(); - $stmt = $db->prepare('SELECT * FROM oauth_scopes WHERE oauth_scopes.key = :scope'); + $stmt = $db->prepare('SELECT * FROM oauth_scopes WHERE oauth_scopes.scope = :scope'); $stmt->bindValue(':scope', $scope); $stmt->execute(); @@ -22,7 +22,7 @@ class Scope implements ScopeInterface return array( 'id' => $row->id, - 'scope' => $row->key, + 'scope' => $row->scope, 'name' => $row->name, 'description' => $row->description ); diff --git a/src/League/OAuth2/Server/Storage/ScopeInterface.php b/src/League/OAuth2/Server/Storage/ScopeInterface.php index 34b35b13..15eb214b 100644 --- a/src/League/OAuth2/Server/Storage/ScopeInterface.php +++ b/src/League/OAuth2/Server/Storage/ScopeInterface.php @@ -19,7 +19,7 @@ interface ScopeInterface * Example SQL query: * * - * SELECT * FROM oauth_scopes WHERE oauth_scopes.key = :scope + * SELECT * FROM oauth_scopes WHERE scope = :scope * * * Response: @@ -28,7 +28,7 @@ interface ScopeInterface * Array * ( * [id] => (int) The scope's ID - * [key] => (string) The scope itself + * [scope] => (string) The scope itself * [name] => (string) The scope's name * [description] => (string) The scope's description * )