~xibo-maintainers/xibo/tempel

« back to all changes in this revision

Viewing changes to lib/Storage/ApiAccessTokenStorage.php

  • Committer: Dan Garner
  • Date: 2015-09-29 15:16:59 UTC
  • mto: (454.2.11) (471.2.2)
  • mto: This revision was merged to the branch mainline in revision 468.
  • Revision ID: git-v1:ae24387a7b1397750b6ec86d0f286373da05eb16
Fixed Display Version Information Form (not showing media name)

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
class ApiAccessTokenStorage extends AbstractStorage implements AccessTokenInterface
32
32
{
33
33
    /**
34
 
     * @var StorageServiceInterface
35
 
     */
36
 
    private $store;
37
 
 
38
 
    /**
39
 
     * ApiAccessTokenStorage constructor.
40
 
     * @param StorageServiceInterface $store
41
 
     */
42
 
    public function __construct($store)
43
 
    {
44
 
        if (!$store instanceof StorageServiceInterface)
45
 
            throw new \RuntimeException('Invalid $store');
46
 
 
47
 
        $this->store = $store;
48
 
    }
49
 
 
50
 
    /**
51
 
     * Get Store
52
 
     * @return StorageServiceInterface
53
 
     */
54
 
    protected function getStore()
55
 
    {
56
 
        return $this->store;
57
 
    }
58
 
 
59
 
    /**
60
34
     * {@inheritdoc}
61
35
     */
62
36
    public function get($token)
63
37
    {
64
 
        $result = $this->getStore()->select('
 
38
        $result = PDOConnect::select('
65
39
            SELECT *
66
40
              FROM oauth_access_tokens
67
41
             WHERE access_token = :access_token
85
59
     */
86
60
    public function getScopes(AccessTokenEntity $token)
87
61
    {
88
 
        $result = $this->getStore()->select('
 
62
        $result = PDOConnect::select('
89
63
            SELECT oauth_scopes.id, oauth_scopes.description
90
64
              FROM oauth_access_token_scopes
91
65
                INNER JOIN oauth_scopes ON oauth_access_token_scopes.scope = oauth_scopes.id
114
88
     */
115
89
    public function create($token, $expireTime, $sessionId)
116
90
    {
117
 
        $this->getStore()->insert('
 
91
        PDOConnect::insert('
118
92
            INSERT INTO oauth_access_tokens (access_token, session_id, expire_time)
119
93
              VALUES (:access_token, :session_id, :expire_time)
120
94
        ', [
129
103
     */
130
104
    public function associateScope(AccessTokenEntity $token, ScopeEntity $scope)
131
105
    {
132
 
        $this->getStore()->insert('
 
106
        PDOConnect::insert('
133
107
            INSERT INTO oauth_access_token_scopes (access_token, scope)
134
108
              VALUES (:access_token, :scope)
135
109
        ', [
143
117
     */
144
118
    public function delete(AccessTokenEntity $token)
145
119
    {
146
 
        $this->getStore()->update('DELETE FROM `oauth_access_token_scopes` WHERE access_token = :access_token', [ 'access_token' => $token->getId()]);
147
 
        $this->getStore()->update('DELETE FROM `oauth_access_tokens` WHERE access_token = :access_token', [ 'access_token' => $token->getId()]);
 
120
        PDOConnect::update('DELETE FROM WHERE access_token = :access_token', [ 'access_token' => $token->getId()]);
148
121
    }
149
122
}
 
 
b'\\ No newline at end of file'