]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/OAuthTokens/vardefs.php
Release 6.5.0
[Github/sugarcrm.git] / modules / OAuthTokens / vardefs.php
1 <?php
2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4  * SugarCRM Community Edition is a customer relationship management program developed by
5  * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
6  * 
7  * This program is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU Affero General Public License version 3 as published by the
9  * Free Software Foundation with the addition of the following permission added
10  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11  * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
13  * 
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
17  * details.
18  * 
19  * You should have received a copy of the GNU Affero General Public License along with
20  * this program; if not, see http://www.gnu.org/licenses or write to the Free
21  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22  * 02110-1301 USA.
23  * 
24  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25  * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
26  * 
27  * The interactive user interfaces in modified source and object code versions
28  * of this program must display Appropriate Legal Notices, as required under
29  * Section 5 of the GNU Affero General Public License version 3.
30  * 
31  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32  * these Appropriate Legal Notices must retain the display of the "Powered by
33  * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34  * technical reasons, the Appropriate Legal Notices must display the words
35  * "Powered by SugarCRM".
36  ********************************************************************************/
37
38 $dictionary['OAuthToken'] = array('table' => 'oauth_tokens',
39         'comment' => 'OAuth tokens',
40         'audited'=>false,
41         'fields' => array (
42           'id' =>
43           array (
44             'name' => 'id',
45             'vname' => 'LBL_ID',
46             'type' => 'id',
47             'required'=>true,
48             'reportable'=>true,
49             'comment' => 'Unique identifier'
50           ),
51       'secret' =>
52       array (
53             'name' => 'secret',
54             'type' => 'varchar',
55             'len' => 32,
56             'required' => true,
57             'comment' => 'Secret key',
58       ),
59       'tstate' =>
60       array (
61             'name' => 'tstate',
62             'type' => 'enum',
63             'len' => 1,
64             'options' => 'token_status',
65             'required' => true,
66             'comment' => 'Token state',
67
68       ),
69       'consumer' =>
70       array (
71             'name' => 'consumer',
72             'type' => 'id',
73             'required' => true,
74             'comment' => 'Token related to the consumer',
75       ),
76       'token_ts' =>
77       array (
78             'name' => 'token_ts',
79             'type' => 'long',
80             'required' => true,
81             'comment' => 'Token timestamp',
82             'function' => array('name' => 'displayDateFromTs', 'returns' => 'html', 'onListView' => true)
83       ),
84       'verify' =>
85       array (
86             'name' => 'verify',
87             'type' => 'varchar',
88             'len' => 32,
89             'comment' => 'Token verification info',
90       ),
91 //      'authdata' =>
92 //      array (
93 //            'name' => 'verify',
94 //            'type' => 'text',
95 //            'comment' => 'Token auth data',
96 //      ),
97           'deleted' =>
98           array (
99             'name' => 'deleted',
100             'vname' => 'LBL_DELETED',
101             'type' => 'bool',
102             'default' => '0',
103             'reportable'=>false,
104             'required' => true,
105                 'isnull' => false,
106             'comment' => 'Record deletion indicator'
107           ),
108         'callback_url' =>
109       array (
110             'name' => 'callback_url',
111             'type' => 'url',
112             'len' => 255,
113             'required' => false,
114             'comment' => 'Callback URL for Authorization',
115       ),
116       'consumer_link' =>
117       array (
118         'name' => 'consumer_link',
119         'type' => 'link',
120         'relationship' => 'consumer_tokens',
121         'vname' => 'LBL_CONSUMER',
122         'link_type' => 'one',
123         'module'=>'OAuthKeys',
124         'bean_name'=>'OAuthKey',
125         'source'=>'non-db',
126       ),
127       'consumer_name' =>
128           array (
129                     'name' => 'consumer_name',
130                     'link'=>'consumer_link' ,
131                     'vname' => 'LBL_CONSUMER',
132                     'rname' => 'name',
133                     'type' => 'relate',
134                     'reportable'=>false,
135                     'source'=>'non-db',
136                     'table' => 'oauth_consumer',
137                     'id_name' => 'consumer',
138                     'module'=>'OAuthKeys',
139                     'duplicate_merge'=>'disabled'
140           ),
141          'assigned_user_id' =>
142                 array (
143                         'name' => 'assigned_user_id',
144                         'rname' => 'user_name',
145                         'id_name' => 'assigned_user_id',
146                         'vname' => 'LBL_ASSIGNED_TO_ID',
147                         'group'=>'assigned_user_name',
148                         'type' => 'relate',
149                         'table' => 'users',
150                         'module' => 'Users',
151                         'reportable'=>true,
152                         'isnull' => 'false',
153                         'dbType' => 'id',
154                         'audited'=>true,
155                         'comment' => 'User ID assigned to record',
156             'duplicate_merge'=>'disabled'
157                 ),
158          'assigned_user_name' =>
159          array (
160                     'name' => 'assigned_user_name',
161                     'link'=>'assigned_user_link' ,
162                     'vname' => 'LBL_ASSIGNED_TO_NAME',
163                     'rname' => 'user_name',
164                     'type' => 'relate',
165                     'reportable'=>false,
166                     'source'=>'non-db',
167                     'table' => 'users',
168                     'id_name' => 'assigned_user_id',
169                     'module'=>'Users',
170                     'duplicate_merge'=>'disabled'
171          ),
172          'assigned_user_link' =>
173       array (
174         'name' => 'assigned_user_link',
175         'type' => 'link',
176         'relationship' => 'oauthtokens_assigned_user',
177         'vname' => 'LBL_ASSIGNED_TO_USER',
178         'link_type' => 'one',
179         'module'=>'Users',
180         'bean_name'=>'User',
181         'source'=>'non-db',
182         'duplicate_merge'=>'enabled',
183         'rname' => 'user_name',
184         'id_name' => 'assigned_user_id',
185         'table' => 'users',
186   ),
187   ),
188     'indices' => array (
189        'id'=>array('name' =>'oauthtokenpk', 'type' =>'primary', 'fields'=>array('id', 'deleted')),
190        'state_ts'=>array('name' =>"oauth_state_ts", 'type' =>'index', 'fields'=>array('tstate','token_ts')),
191        'consumer'=>array('name' =>"constoken_key", 'type' =>'index', 'fields'=>array('consumer')),
192     ),
193    'relationships'=>array(
194         'consumer_tokens' =>
195            array('lhs_module'=> 'OAuthKeys', 'lhs_table'=> 'oauth_consumer', 'lhs_key' => 'id',
196                                 'rhs_module'=> 'OAuthTokens', 'rhs_table'=> 'oauth_tokens', 'rhs_key' => 'consumer',
197                                 'relationship_type'=>'one-to-many'),
198           'oauthtokens_assigned_user' =>
199            array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
200            'rhs_module'=> 'OAuthTokens' , 'rhs_table'=> 'oauth_tokens', 'rhs_key' => 'assigned_user_id',
201            'relationship_type'=>'one-to-many')
202            )
203 );