-
Notifications
You must be signed in to change notification settings - Fork 676
/
interface.OwnerInstanceDAO.php
112 lines (112 loc) · 3.75 KB
/
interface.OwnerInstanceDAO.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
/**
*
* ThinkUp/webapp/_lib/model/interface.OwnerInstanceDAO.php
*
* Copyright (c) 2009-2013 Gina Trapani, Mark Wilkie
*
* LICENSE:
*
* This file is part of ThinkUp (http://thinkup.com).
*
* ThinkUp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any
* later version.
*
* ThinkUp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with ThinkUp. If not, see
* <http://www.gnu.org/licenses/>.
*
*
* OwnerInstance Data Access Object interface
*
* @license http://www.gnu.org/licenses/gpl.html
* @copyright 2009-2013 Gina Trapani, Mark Wilkie
* @author Mark Wilkie <mwilkie[at]gmail[dot]com>
*
*/
interface OwnerInstanceDAO {
/**
* Check if an Owner has access to an instance
* @throws BadArgumentException If we do not pass a valid owner object
* @param Owner
* @param Instance
* @return bool true if yes, false if not
*/
public function doesOwnerHaveAccessToInstance(Owner $owner, Instance $instance);
/**
* Check if an Owner has access to a an individual post
* @throws BadArgumentException If we do not pass a valid owner object
* @param Owner
* @param Post
* @return bool true if yes, false if not
*/
public function doesOwnerHaveAccessToPost(Owner $owner, Post $post);
/**
* Get an owner instance by owner_id and instance_id
* @param int owner_id
* @param int instance_id
* @return OwnerInstance
*/
public function get($owner_id, $instance_id);
/**
* Get owner instances by an instance ID
* @param int instance_id
* @return array OwnerInstance objects
*/
public function getByInstance($instance_id);
/**
* Get owner instances by an owner ID
* @param int owner_id
* @return array OwnerInstance objects
*/
public function getByOwner($owner_id);
/**
* Inserts an owner instance record
* @param int owner_id
* @param int instance_id
* @param str auth_token
* @param str oauth_token_secret
* @return bool - if insert was successful
*/
public function insert($owner_id, $instance_id, $oauth_token = '', $oauth_token_secret = '');
/**
* Delete an owner instance record
* @param int owner_id
* @param int instance_id
* @return int Number of rows affected
*/
public function delete($owner_id, $instance_id);
/**
* Delete all owner instances by instance ID.
* @param int instance_id
* @return int Number of rows affected
*/
public function deleteByInstance($instance_id);
/**
* Updates tokens based on user and instance ids, return true|false update status
* @param int owner_id
* @param int instance_id
* @param str oauth_token
* @param str oauth_token_secret
* @return bool
*/
public function updateTokens($owner_id, $instance_id, $oauth_token, $oauth_token_secret);
/**
* Updates auth error for owner/instance, return true|false for update status
* @param int owner_id
* @param int instance_id
* @param str auth_error Optional, leave blank or null when there's no error during successful auth
* @return bool
*/
public function setAuthError($owner_id, $instance_id, $auth_error='');
/**
* Gets auth tokens by instance_id
* @param int instance_id
* @return array $token_assoc_array
*/
public function getOAuthTokens($id);
}