-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
563 lines (494 loc) · 16.8 KB
/
index.html
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
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Group an alternative to Organic Groups</title>
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/dbridge.css">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<link rel="stylesheet" href="lib/fontawesome/css/font-awesome.min.css">
<link rel='shortcut icon' href='media/images/favicon-group.ico' type='image/x-icon'/ >
</head>
<body>
<div class="reveal">
<div class="slides">
<!-- Title -->
<section>
<a href="https://www.drupal.org/project/group"><img src="media/images/GROUP-logo.gif"></a>
<h2>An Alternative to Organic Groups</h2>
<p>
<small>Presentation by Kyle Einecker</small>
</p>
<aside class="notes">
<ul>
<li>used OG?</li>
<li>wanted to bang your head against a wall?</li>
</ul>
</aside>
</section>
<!-- About me -->
<section>
<h2>The part about me</h2>
<p class="fragment"><img src="media/images/dbridge.png"></p>
<span class="fragment">
<span>ctrlADel</span>
<a href="https://www.drupal.org/u/ctrladel"><i class="fa fa-drupal fa-3x" aria-hidden="true"></i></a>
<a href="https://github.com/ctrladel"><i class="fa fa-github fa-3x" aria-hidden="true"></i></a>
</span>
<p class="fragment"><a href="https://twitter.com/dbridgechicago"><i class="fa fa-twitter fa-3x" aria-hidden="true"></i> @DBridgeChicago</a></p>
<aside class="notes">
<ul>
<li>generalist</li>
<li>prefer backend</li>
<li>we're hiring</li>
</ul>
</aside>
</section>
<!-- About group -->
<section>
<h2>The part about group</h2>
<p class="fragment"><img src="media/images/kristiaan.jpg" style="vertical-align: middle"> <span style="vertical-align: middle">kristiaanvandeneynde</span></p>
<p class="fragment">Been around since 2013</p>
<p class="fragment">~1,500 installs</p>
<img class="fragment" src="media/images/drupal8.png" height="100px">
<aside class="notes">
<ul>
<li>actively maintained</li>
<li>active issue queue</li>
</ul>
</aside>
</section>
<!-- The problem -->
<section>
<section>
<h1>The problem</h1>
<aside class="notes">
<ul>
<li>10,000ft look at the problem</li>
</ul>
</aside>
</section>
<section>
<h2>Unorganized content is hard to</h2>
<br>
<h3 class="secondary-heading-color">Display</h3>
<h3 class="secondary-heading-color">Manage</h3>
<h3 class="secondary-heading-color">Control access to</h3>
<h3 class="secondary-heading-color">Migrate</h3>
<aside class="notes">
<ul>
<li>hard to make meaningful pages</li>
<li>hard for editors to manage</li>
<li>hard to control access for editors and users</li>
<li>when you eventually update to a new version/platform</li>
</ul>
</aside>
</section>
<section>
<img src="media/images/450_messy1_080516.jpg">
<aside class="notes">
<ul>
<li>we don't want our sites be the digital equivalent of this</li>
</ul>
</aside>
</section>
<section>
<h2>The strategies</h2>
<div class="fragment">
<h4 class="secondary-heading-color">Tagging</h4>
<p style="font-size: 0.8em">Add keywords about a book</p>
</div>
<div class="fragment">
<h4 class="secondary-heading-color">Relate content</h4>
<p style="font-size: 0.8em">Relate a book to say it's author or series</p>
</div>
<div class="fragment">
<h4 class="secondary-heading-color">Access control</h4>
<p style="font-size: 0.8em">Control access to a book</p>
</div>
<div class="fragment">
<h4 class="secondary-heading-color">Hierarchy</h4>
<p style="font-size: 0.8em">Organize books on shelves and bookcases</p>
</div>
<div class="fragment">
<h4 class="secondary-heading-color">Hierarchical access control</h4>
<p style="font-size: 0.8em">Control access to specific shelves and bookcases</p>
</div>
<aside class="notes">
<ul>
<li>hierarchical access control - niche but once you have the others it is wanted</li>
<li>hard to make meaningful pages</li>
<li>lots of overlap</li>
</ul>
</aside>
</section>
<section>
<img src="media/images/front%20desk%20and%20stacks.jpg">
<aside class="notes">
<ul>
<li>this is what we want our site to look like</li>
<li>nicer to look at</li>
<li>easy to control access</li>
<li>can send people to a specific spot</li>
<li>unless you like a mess this is better</li>
</ul>
</aside>
</section>
<section>
<h1>The options</h1>
<table class="reveal">
<tr>
<th class=""></th>
<th class="">Tagging</th>
<th class="apply-border-top apply-border-left">Relate content</th>
<th class="apply-border-top apply-border-right">Access control</th>
<th class="">Hierarchy</th>
</tr>
<tr class="fragment">
<td class="">Taxonomy</td>
<td class=""><i class="fa fa-check fa-2x" aria-hidden="true"></i></td>
<td class="apply-border-left"><i class="fa fa-check fa-2x" aria-hidden="true"></i></td>
<td class="apply-border-right"><i class="fa fa-check fa-2x" aria-hidden="true"></i></td>
<td class=""><i class="fa fa-check fa-2x" aria-hidden="true"></i></td>
</tr>
<tr class="fragment">
<td class="">Entity reference</td>
<td class=""></td>
<td class="apply-border-left"><i class="fa fa-check fa-2x" aria-hidden="true"></i></td>
<td class="apply-border-right"></td>
<td class=""></td>
</tr>
<tr class="fragment">
<td class="">Organic groups</td>
<td class=""><i class="fa fa-check fa-2x" aria-hidden="true"></i></td>
<td class="apply-border-left"><i class="fa fa-check fa-2x" aria-hidden="true"></i></td>
<td class="apply-border-right"><i class="fa fa-check fa-2x" aria-hidden="true"></i></td>
<td class=""></td>
</tr>
<tr class="fragment">
<td class="">Group</td>
<td class=""><i class="fa fa-check fa-2x" aria-hidden="true"></i></td>
<td class="apply-border-left apply-border-bottom"><i class="fa fa-check fa-2x" aria-hidden="true"></i></td>
<td class="apply-border-right apply-border-bottom"><i class="fa fa-check fa-2x" aria-hidden="true"></i></td>
<td class=""><i class="fa fa-check fa-2x" aria-hidden="true"></i></td>
</tr>
</table>
<span class="fragment apply-table-border"></span>
<aside class="notes">
<ul>
<li>often use multiple</li>
<li>lines are very blurry</li>
<li>focus on groups strengths relating content/access control</li>
</ul>
</aside>
</section>
</section>
<!-- Organic Groups and Group -->
<section>
<section>
<h1>Organic Groups and Group</h1>
<aside class="notes">
<ul>
<li>look at what both OG and Group are good/bad at</li>
</ul>
</aside>
</section>
<section>
<h2>Strengths</h2>
<p class="fragment">Arbitrary grouping of content</p>
<p class="fragment">Arbitrary grouping of users</p>
<p class="fragment">Access control</p>
<div class="fragment">
<p>Integration with major contrib modules</p>
<ul>
<li>Views</li>
<li>Panels</li>
<li>Rules</li>
<li>Pathauto</li>
<li>Features</li>
</ul>
</div>
</section>
<section>
<h2>Weaknesses</h2>
<p class="fragment">Can be complex to setup</p>
<p class="fragment">Can impact performance</p>
<p class="fragment">Unwanted interactions with other access control modules</p>
</section>
</section>
<!-- Group vs OG -->
<section>
<section>
<h1>Group vs OG</h1>
</section>
<section>
<h2>Advantages</h2>
<p class="fragment">Easy to setup</p>
<p class="fragment">Entity based</p>
<p class="fragment">Subgroups by default</p>
<p class="fragment">Easy to extend</p>
<p class="fragment">Seamless integration with UI</p>
</section>
<section>
<h2>Disadvantages</h2>
<p class="fragment">Not organic</p>
<p class="fragment">No mixing public and private content of the same type</p>
<p class="fragment">Multiple parent groups not currently supported</p>
<p class="fragment">Fewer prebuilt integrations</p>
</section>
</section>
<section>
<h1>Group</h1>
</section>
<section>
<section>
<h1>Architecture</h1>
</section>
<section>
<p class="fragment">Everything is a custom entity</p>
<h4 class="fragment secondary-heading-color">Groups</h4>
<h4 class="fragment secondary-heading-color">Group memberships</h4>
<h4 class="fragment secondary-heading-color">Group roles</h4>
<p class="fragment">Everything has it's own class</p>
</section>
<section>
<h2>Making an entity a child of Group</h2>
<pre class="fragment"><code class="hlphp" data-trim contenteditable>
/**
* Implements hook_entity_info_alter().
*/
function gnode_entity_info_alter(&$entity_info) {
// Nodes can only have one group parent.
$entity_info['node']['group entity'] = 'single';
}
</code></pre>
<span class="fragment">
<p>Implement access control</p>
<p>Integrate with entity' s interface</p>
</span>
</section>
</section>
<section>
<section>
<h1>Code Examples</h1>
</section>
<section>
<h2>Add a member to a group</h2>
<p>OG</p>
<pre><code class="hlphp" data-trim contenteditable>
global $user;
$group = node_load($gid);
if (!$group_type) {
$group_type = 'node';
}
if (!$membership_type) {
$membership_type = OG_MEMBERSHIP_TYPE_DEFAULT;
}
$is_a_group = $group->group_group[$group->language][0]['value'];
if ($is_a_group && $user) {
$values = array(
'entity_type' => 'user',
'entity' => $user,
'state' => OG_STATE_ACTIVE,
'membership_type' => $membership_type
);
og_group($group_type, $gid, $values);
</code></pre>
</section>
<section>
<h2>Add a member to a group</h2>
<p>Group</p>
<pre><code class="hlphp" data-trim contenteditable>
global $user;
$group = group_load($gid);
$group->addMember($user->uid);
</code></pre>
</section>
<section>
<h2>Get all group members</h2>
<p>OG</p>
<pre><code class="hlphp" data-trim contenteditable>
$group = node_load($gid);
og_get_group_members_properties($group, array(), 'members', 'node');
</code></pre>
</section>
<section>
<h2>Get all group members</h2>
<p>Group</p>
<pre><code class="hlphp" data-trim contenteditable>
$group = group_load($gid);
$members = $group->getMembers();
</code></pre>
<p class="fragment">Get all group members of all subgroups</p>
<pre class="fragment"><code class="hlphp" data-trim contenteditable>
$group = group_load($gid);
$members = $group->getMembersRecursive();
</code></pre>
</section>
<section>
<h2>Get all nodes in group</h2>
<p>OG</p>
<pre><code class="hlphp" data-trim contenteditable>
I couldn't find a good answer
</code></pre>
</section>
<section>
<h2>Get all nodes in group</h2>
<p>Group</p>
<pre><code class="hlphp" data-trim contenteditable>
$group = group_load($gid);
$nodes = $group->getEntitiesOfType('node');
</code></pre>
<p class="fragment">Get all entities in group</p>
<pre class="fragment"><code class="hlphp" data-trim contenteditable>
$group = group_load($gid);
$entities = $group->getEntities();
</code></pre>
</section>
</section>
<section>
<section>
<h1>DocBlocks</h1>
<h2 class="fragment">and comments!</h2>
</section>
<section>
<h2>Group::addMember()</h2>
<pre><code class="hlphp" data-trim contenteditable>
/**
* Add a user to a group.
*
* If the user is anonymous or already a member, nothing changes.
*
* @param int $uid
* The uid of the member.
* @param array $values
* (optional) Extra values to add to the GroupMembership entity, like the
* 'roles' property. You cannot overwrite the group id (gid) or user id
* (uid) with this method. Leave blank to make the user 'just a member'.
*/
public function addMember($uid, array $values = array()) {
</code></pre>
</section>
<section>
<h2>Group::getMembers()</h2>
<pre><code class="hlphp" data-trim contenteditable>
/**
* Get all members of a group.
*
* @return array
* An array of GroupMembership entities.
*/
public function getMembers() {
</code></pre>
</section>
<section>
<h2>Group::getEntities()</h2>
<pre><code class="hlphp" data-trim contenteditable>
/**
* Get all child entities.
*
* @param bool $flat
* (optional) Whether or not to flatten the result array.
* @param bool $reset
* (optional) Whether to reset the internal cache.
*
* @return array
* An array of child entities, keyed by their type, bundle and entity id.
* When $flat is set to TRUE, the return value is one big array of
* entities, which are keyed numerically and not by their entity id!
*/
public function getEntities($flat = FALSE, $reset = FALSE) {
</code></pre>
<p>Found in this function</p>
<pre><code class="hlphp" data-trim contenteditable=>
// We run the entity_load() result through array_values() to prevent
// people from making the false assumption that we still return the
// entity ids as array keys.
</code></pre>
</section>
<section>
<h2>Group::getEntitiesOfType()</h2>
<pre><code class="hlphp" data-trim contenteditable>
/**
* Get all child entities of a certain type.
*
* @param string $entity_type
* The type of child entities.
* @param string $bundle
* (optional) The bundle of the entity type.
*
* @return array
* An array of child entities of a certain type and optionally bundle,
* keyed by their entity id.
*/
public function getEntitiesOfType($entity_type, $bundle = NULL) {
</code></pre>
</section>
<section>
<h2>gnode_form_node_form_alter</h2>
<pre><code class="hlphp" data-trim contenteditable>
// If the user can't bypass group access or administer the parent group and we
// already have a nid or gid, we are either on a node edit form or a Group
// Node add form. In such a case, we do not show anything.
</code></pre>
<pre><code class="hlphp" data-trim contenteditable>
// There is a special use case where a user may edit global nodes, but
// not create them and also may bypass group access. In such a case, he
// could move an ungrouped node to a group, or leave it ungrouped.
if (!empty($node->nid) && empty($gid) && !$global_node_create_access) {
</code></pre>
</section>
</section>
<section>
<img src="media/images/livedemo.gif">
</section>
<section>
<h1>Differences in D8</h1>
<div class="d8-diagram">
<img src="media/images/d8-group-group.svg">
<img class="fragment" src="media/images/d8-group-groupcontent.svg">
<img src="media/images/d8-group-node.svg">
</div>
</section>
<section>
<h1>Questions?</h1>
</section>
<section>
<h1>The end</h1>
<p>Slides available at <a href="https://ctrladel.github.io/stl2016">ctrladel.github.io/stl2016</a></p>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script>
// More info https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
history: true,
// More info https://github.com/hakimel/reveal.js#dependencies
dependencies: [
{ src: 'plugin/markdown/marked.js' },
{ src: 'plugin/markdown/markdown.js' },
{ src: 'plugin/notes/notes.js', async: true },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }
]
});
</script>
<script src="js/dbridge.js"></script>
<aside class="db-logo-footer">
<a href="http://www.dbridgesolutions.com/">
<img src="media/images/db.png">
</a>
</aside>
</body>
</html>