foldershare-8.x-1.2/src/Annotation/FolderShareCommand.php

src/Annotation/FolderShareCommand.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
<?php
 
namespace Drupal\foldershare\Annotation;
 
use Drupal\Component\Annotation\Plugin;
 
/**
 * Defines the annotation for command plugins.
 *
 * A command is similar to a Drupal action. It has a configuration containing
 * operands for the command, and an execute() function to apply the command
 * to the configuration. Some commands also have configuration forms to
 * prompt for operands.
 *
 * Commands differ from Drupal actions by including extensive annotation
 * that governs how that command appears in menus and under what circumstances
 * the command may be applied. For instance, annotation may indicate if
 * the command applies to files or folders or both, whether it requires a
 * selection and if that selection can include more than one item, and
 * what access permissions the user must have on the parent folder and on
 * the selection.
 *
 * Annotation for a command can be broken down into groups of information:
 *
 * - Identification:
 *   - the unique machine name for the plugin.
 *
 * - User interface:
 *   - the labels for the plugin.
 *   - the user interface category and weight for presenting the command.
 *
 * - Constraints and access controls:
 *   - the parent folder constraints and access controls required, if needed.
 *   - the selection constraints and access controls required, if needed.
 *   - the destination constraints and access controls required, if needed.
 *   - any special handling needed.
 *
 * There are several plugin labels that may be specified. Each is used in
 * a different context:
 *
 * - "label" is a generic name for the command, such as "Edit" or "Delete".
 *   This label may be used in error messages, such as "The Delete command
 *   requires a selection."
 *
 * - "menuNameDefault" is the command name used in menus when no better text
 *   is available in "menuName". The default text is primarily used when the
 *   menu item is disabled. If not given, this defaults to the value of "label".
 *
 * - "menuName" is the command name to use in menus. This is primarily used
 *   for selectable menu items and the text may include the "@operand" marker,
 *   which will be replaced with the name of an item or a kind, such as
 *   "Edit @operand...". If not given, this defaults to the value of
 *   "menuNameDefault".
 *
 * "label", "menuNameDefault", and "menuName" should all use
 * title-case except for small connecting words like "of", "in", and "and".
 *
 * An optional "@operand" is replaced with text that varies depending upon
 * use.  Possibilities include:
 *
 * - Replaced with a singular name of the kind of operand, such as
 *   "Delete file" or "Delete folder". If the context is the current item,
 *   the word "this" may be inserted, such as "Delete this file".
 *
 * - Replaced with a plural name of the kind for all operands, such as
 *   "Delete files" or "Delete folders".
 *
 * - Replaced with a plural "items" if the kinds of the operands is mixed,
 *   such as "Delete items".
 *
 * - Replaced with the quoted singular name of the operand when there is
 *   just one item (typically for form titles), such as "Delete "Bob's folder"".
 *
 * The plugin namespace for commands is "Plugin\FolderShareCommand".
 *
 * @ingroup foldershare
 *
 * @Annotation
 */
class FolderShareCommand extends Plugin {
 
  /*--------------------------------------------------------------------
   * Identification
   *--------------------------------------------------------------------*/
 
  /**
   * The unique machine-name plugin ID.
   *
   * The value is taken from the plugin's 'id' annotation.
   *
   * The ID must be a unique string used to identify the plugin. Often it
   * is closely related to a module namespace and class name.
   *
   * @var string
   */
  public $id = '';
 
  /*--------------------------------------------------------------------
   * User interface
   *--------------------------------------------------------------------*/
 
  /**
   * The generic command label for user interfaces.
   *
   * The label is used by user interface code for buttons and error messages.
   * The value is required.
   *
   * The text should be translated and use title-case where each word is
   * capitalized, except for small connecting words like "of" or "in".
   *
   * Examples:
   * - "Change Owner".
   * - "Delete".
   * - "Edit".
   * - "Rename".
   *
   * @var \Drupal\Core\Annotation\Translation
   *
   * @ingroup plugin_translatable
   */
  public $label = '';
 
  /**
   * The name for disabled user interface menus.
   *
   * The menu name is used for user interface code to create a menu item for
   * the command when the command is disabled and not available to the user.
   * If no menu name is given, the value defaults to the value of the
   * 'label' field.
   *
   * The text should be translated and use title-case where each word is
   * capitalized, except for small connecting words like "of" or "in".
   *
   * Examples:
   * - "Change Owner...".
   * - "Delete...".
   * - "Edit...".
   * - "Rename...".
   *
   * @var \Drupal\Core\Annotation\Translation
   *
   * @ingroup plugin_translatable
   */
  public $menuNameDefault = '';
 
  /**
   * The name for enabled user interface menus.
   *
   * The menu name is used for user interface code to create a menu item for
   * the command when the command is enabled and available to the user. If
   * no menu name is given, the value defaults to the value of the
   * 'menuNameDefault' field.
   *
   * The text should be translated and use title-case where each word is
   * capitalized, except for small connecting words like "of" or "in".
   *
   * The text may include "@operand" to mark where the name of an item or
   * item kind should be inserted.
   *
   * Examples:
   * - "Change Owner of @operand...".
   * - "Delete @operand...".
   * - "Edit @operand...".
   * - "Rename @operand...".
   *
   * @var \Drupal\Core\Annotation\Translation
   *
   * @ingroup plugin_translatable
   */
  public $menuName = '';
 
  /**
   * A brief description of the command.
   *
   * @var string
   */
  public $description = '';
 
  /**
   * The command's category within user interfaces.
   *
   * The category gives the name of a group into which the command should be
   * sorted when it is presented in a menu. Category names must be lower case.
   *
   * The module defines a set of well-known categories that may be used.
   * Any category name not on this list is appended to the end of menus
   * based upon these categories.
   *
   * Well-known categories are (in order):
   * - "open".
   * - "import & export".
   * - "close".
   * - "edit".
   * - "delete".
   * - "copy & move".
   * - "save".
   * - "archive".
   * - "message".
   * - "settings".
   * - "administer".
   *
   * @var string
   *
   * @see \Drupal\Core\Plugin\CategorizingPluginManagerTrait
   * @see \Drupal\Component\Plugin\CategorizingPluginManagerInterface
   */
  public $category = '';
 
  /**
   * The commands weight among other commands in the same category.
   *
   * The value is taken from the plugin's 'weight' annotation and should
   * be a positive or negative integer.
   *
   * Weights are used to sort commands within a category before they
   * are presented within a menu, toobar of buttons, etc. Higher weights
   * are listed later in the category.
   *
   * @var int
   */
  public $weight = 0;
 
  /*--------------------------------------------------------------------
   * Constraints and access controls
   *--------------------------------------------------------------------*/
 
  /**
   * The command's user constraints.
   *
   * Defined by the 'userConstraints' annotation, this value is an array
   * of user type requirements:
   * - 'any' (default).
   * - 'anonymous'.
   * - 'authenticated'.
   * - 'adminpermission'.
   * - 'noadminpermission'.
   * - 'authorpermission'.
   * - 'sharepermission'.
   * - 'sharepublicpermission'.
   * - 'viewpermission'.
   *
   * The constraint is met if any choice is met (i.e. they are ORed together).
   *
   * @var array
   */
  public $userConstraints = NULL;
 
  /**
   * The command's parent constraints.
   *
   * Defined by the 'parentConstraints' annotation, this value is an
   * associative array with keys:
   * - 'kinds': an optional list of the kinds of parents supported.
   * - 'access': an optional access operation that the parent must support.
   * - 'ownership': an optional list of ownerships supported.
   *
   * <B>Parent kinds</B><BR>
   * The 'kinds' field lists the kinds of parent supported:
   * - 'any' (default).
   * - 'rootlist'.
   * - Any kind supported by FolderShare (e.g. 'file', 'folder').
   *
   * The constraint is met if any choice is met (i.e. they are ORed together).
   *
   * <B>Parent access</B><BR>
   * The 'access' field names ONE access operation the parent must support:
   * - 'chown'.
   * - 'create'.
   * - 'delete'.
   * - 'share'.
   * - 'update'.
   * - 'view' (default).
   *
   * <B>Parent ownership</B><BR>
   * The 'ownership' field lists the ownership states the parent supports:
   * - 'any' (default).
   * - 'ownedbyanonymous'.
   * - 'ownedbyanother'.
   * - 'ownedbyuser'.
   * - 'sharedbyuser'.
   * - 'sharedwithanonymoustoview'.
   * - 'sharedwithanonymoustoauthor'.
   * - 'sharedwithusertoview'.
   * - 'sharedwithusertoauthor'.
   *
   * The constraint is met if any choice is met (i.e. they are ORed together).
   *
   * @var array
   */
  public $parentConstraints = NULL;
 
  /**
   * The command's selection constraints, if any.
   *
   * Defined by the 'selectionConstraints' annotation, this value is an
   * associative array with keys:
   * - 'types': an optional indicator of the selection size.
   * - 'kinds': an optional list of the kinds of selected items supported.
   * - 'access': an optional access operation that the selection must support.
   * - 'ownership': an optional list of ownerships supported.
   *
   * <B>Selection types</B><BR>
   * The 'types' field lists types of selection supported:
   * - 'none' (default).
   * - 'parent'.
   * - 'one'.
   * - 'many'.
   *
   * The constraint is met if any choice is met (i.e. they are ORed together).
   *
   * <B>Selection kinds</B><BR>
   * The 'kinds' field lists the kinds of selection supported:
   * - 'any' (default).
   * - Any kind supported by FolderShare (e.g. 'file', 'folder').
   *
   * The 'rootlist' kind is not available for selections.
   *
   * The constraint is met if any choice is met (i.e. they are ORed together).
   *
   * <B>Selection access</B><BR>
   * The 'access' field names ONE access operation every selected item
   * must support:
   * - 'chown'.
   * - 'create'.
   * - 'delete'.
   * - 'share'.
   * - 'update'.
   * - 'view' (default).
   *
   * <B>Selection ownership</B><BR>
   * The 'ownership' field lists the ownership states the selection supports:
   * - 'any' (default).
   * - 'ownedbyanonymous'.
   * - 'ownedbyanother'.
   * - 'ownedbyuser'.
   * - 'sharedbyuser'.
   * - 'sharedwithanonymoustoview'.
   * - 'sharedwithanonymoustoauthor'.
   * - 'sharedwithusertoview'.
   * - 'sharedwithusertoauthor'.
   *
   * The constraint is met if any choice is met (i.e. they are ORed together).
   *
   * <B>Selection file extensions</B><BR>
   * The 'fileExtensions' field lists file name extensions the selection
   * supports. An empty list (the default) supports everything.
   *
   * @var array
   */
  public $selectionConstraints = NULL;
 
  /**
   * The command's destination constraints, if any.
   *
   * Defined by the 'destinationConstraints' annotation, this value is an
   * associative array with keys:
   * - 'kinds': an optional list of the kinds of selected items supported.
   * - 'access': an optional access operation that the selection must support.
   * - 'ownership': an optional list of ownerships supported.
   *
   * <B>Destination kinds</B><BR>
   * The 'kinds' field lists the kinds of destination supported:
   * - 'none' (default).
   * - 'any'.
   * - 'rootlist'.
   * - Any kind supported by FolderShare (e.g. 'file', 'folder').
   *
   * The constraint is met if any choice is met (i.e. they are ORed together).
   *
   * <B>Destination access</B><BR>
   * The 'access' field names ONE access operation the destination must support:
   * - 'chown'.
   * - 'create'.
   * - 'delete'.
   * - 'share'.
   * - 'update' (default).
   * - 'view'.
   *
   * <B>Destination ownership</B><BR>
   * The 'ownership' field lists the ownership states the destination supports:
   * - 'any' (default).
   * - 'ownedbyanonymous'.
   * - 'ownedbyanother'.
   * - 'ownedbyuser'.
   * - 'sharedbyuser'.
   * - 'sharedwithanonymoustoview'.
   * - 'sharedwithanonymoustoauthor'.
   * - 'sharedwithusertoview'.
   * - 'sharedwithusertoauthor'.
   *
   * The constraint is met if any choice is met (i.e. they are ORed together).
   *
   * @var array
   */
  public $destinationConstraints = NULL;
 
  /**
   * The command's special needs, if any.
   *
   * Defined by the 'specialHandling' annotation, this value is an array
   * with known values:
   * - 'upload': the command uploads files.
   *
   * @var array
   */
  public $specialHandling = NULL;
 
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc