Project

General

Profile

Revision c6fe437b

IDc6fe437bfe330b2aa1cc96d32d956edfc14f8b19
Parent 8385a9f2
Child b5ff8a25

Added by Andreas Kohlbecker over 3 years ago

fix #6115 protecting all cdm content with new permission

View differences:

modules/cdm_dataportal/cdm_api/cdm_api.module
84 84
  $items['cdm_api/proxy'] = array(
85 85
    'page callback' => 'proxy_content',
86 86
    'access arguments' => array(
87
      'access content',
87
      'access cdm content',
88 88
    ),
89 89
    'type' => MENU_CALLBACK,
90 90
  );
......
92 92
  $items['cdm_api/setvalue/session'] = array(
93 93
    'page callback' => 'setvalue_session',
94 94
    'access arguments' => array(
95
      'access content',
95
      'access cdm content',
96 96
    ),
97 97
    'type' => MENU_CALLBACK,
98 98
  );
......
192 192
function cdm_api_permission() {
193 193
  return array(
194 194
    'administer cdm_api' => array(
195
      'title' => t('administer cdm_api'),
196
      'description' => t("TODO Add a description for 'administer cdm_api'"),
195
      'title' => t('Administer the cdm_api module'),
196
      'description' => t("Access the settings page for the  cdm_api module"),
197 197
    ),
198 198
  );
199 199
}
modules/cdm_dataportal/cdm_dataportal.install
177 177

  
178 178
    if(is_object($cdm_admin_role)) {
179 179
      // make sure admin is member of role CDM admin
180
      if (!isset($admin_user->roles[$admin_role->rid])) {
180
      if (!isset($admin_user->roles[$cdm_admin_role->rid])) {
181 181
        user_multiple_role_edit(array(1), 'add_role', $cdm_admin_role->rid);
182 182
        $tasks_performed[] = 'admin user (uid=1) added to role ' . $cdm_admin_role->name;
183 183
      }
......
191 191
    $admin_role = user_role_load_by_name("admin"); // Drupal 5
192 192

  
193 193
    if(is_object($admin_role)){
194
      $admin_role->name == 'administrator';
194
      $admin_role->name = 'administrator';
195 195
      user_role_save($admin_role);
196 196
      $tasks_performed[] = 'administrator role name harmonized';
197 197
    } else {
......
399 399
  return join(', ',$tasks_performed);
400 400
}
401 401

  
402
/**
403
 * update for RELEASE 4.4:
404
 *  -  grant new permission 'access cdm content' to default roles
405
 */
406
function cdm_dataportal_update_7400() {
407
  // additional permission for the anonymous user	authenticated user roles
408
  $additional_default_permissions = array(
409
    'access cdm content',
410
    'access extlinks content'
411
  );
412
  user_role_grant_permissions(1, $additional_default_permissions); // anonymous user
413
  user_role_grant_permissions(2, $additional_default_permissions); // authenticated user
414
  $tasks_performed = array();
415
  $tasks_performed[] = "grant new permission 'access cdm content' to default roles";
416
}
402 417

  
403 418
/* ======================================================================== */
404 419

  
modules/cdm_dataportal/cdm_dataportal.module
412 412
      'administer cdm_dataportal' => array(
413 413
        'title' => t('Administer CDM DataPortal settings'),
414 414
        'description' => t("Access the settings pages specific for the cdm_dataportal module"),
415
      )
415
      ),
416
      'access cdm content' => array(
417
        'title' => t('Access CDM content'),
418
        'description' => t("Access content (taxa, names, specimens, etc.) served by the CDM web service."),
419
      ),
416 420
    );
417 421
  }
418 422

  
......
428 432

  
429 433
  $items['cdm_dataportal/names'] = array(
430 434
    'page callback' => 'cdm_dataportal_view_names',
431
    'access arguments' => array('access content'),
435
    'access arguments' => array('access cdm content'),
432 436
    'type' => MENU_CALLBACK,
433 437
  );
434 438

  
435 439
  // Optional callback arguments: page.
436 440
  $items['cdm_dataportal/taxon'] = array(
437 441
    'page callback' => 'cdm_dataportal_taxon_page_view',
438
    'access arguments' => array('access content'),
442
    'access arguments' => array('access cdm content'),
439 443
    'type' => MENU_CALLBACK,
440 444
    // Expected callback arguments: uuid.
441 445
  );
......
444 448
    //FIXME point to view/page method in this module
445 449
    $items['cdm_dataportal/specimen'] = array(
446 450
        'page callback' => 'cdm_dataportal_specimen_page_view',
447
        'access arguments' => array('access content'),
451
        'access arguments' => array('access cdm content'),
448 452
        'type' => MENU_CALLBACK,
449 453
        // Expected callback arguments: uuid.
450 454
    );
......
458 462
       'synonym_uuid' => NULL
459 463
      ),
460 464
      */
461
    'access arguments' => array('access content'),
465
    'access arguments' => array('access cdm content'),
462 466
    'type' => MENU_CALLBACK,
463 467
    // Expected callback arguments: uuid.
464 468
  );
465 469

  
466 470
  $items['cdm_dataportal/reference'] = array(
467 471
    'page callback' => 'cdm_dataportal_view_reference',
468
    'access arguments' => array('access content'),
472
    'access arguments' => array('access cdm content'),
469 473
    'type' => MENU_CALLBACK,
470 474
    // Expected callback arguments: uuid.
471 475
  );
472 476

  
473 477
  $items['cdm_dataportal/reference/list'] = array(
474 478
    'page callback' => 'cdm_dataportal_view_reference_list',
475
    'access arguments' => array('access content'),
479
    'access arguments' => array('access cdm content'),
476 480
    'type' => MENU_CALLBACK,
477 481
    // Expected callback arguments: uuid.
478 482
  );
479 483

  
480 484
  $items['cdm_dataportal/media'] = array(
481 485
    'page callback' => 'cdm_dataportal_view_media',
482
    'access arguments' => array('access content'),
486
    'access arguments' => array('access cdm content'),
483 487
    'type' => MENU_CALLBACK,
484 488
    // Expected callback arguments:
485 489
    // uuid, mediarepresentation_uuid, part_uuid or part#.
......
487 491

  
488 492
  $items['cdm_dataportal/polytomousKey'] = array(
489 493
    'page callback' => 'cdm_dataportal_view_polytomousKey',
490
    'access arguments' => array('access content'),
494
    'access arguments' => array('access cdm content'),
491 495
    'type' => MENU_CALLBACK,
492 496
    // Expected callback arguments: polytomousKey->uuid.
493 497
  );
494 498

  
495 499
  $items['cdm_dataportal/search'] = array(
496 500
    'page callback' => 'cdm_dataportal_view_search_advanced',
497
    'access arguments' => array('access content'),
501
    'access arguments' => array('access cdm content'),
498 502
    'type' => MENU_CALLBACK,
499 503
  );
500 504

  
501 505
  $items['cdm_dataportal/search/advanced'] = array(
502 506
    'title' => 'Advanced', // will be passed through t()
503 507
    'page callback' => 'cdm_dataportal_view_search_advanced',
504
    'access arguments' => array('access content'),
508
    'access arguments' => array('access cdm content'),
505 509
    'type' => MENU_DEFAULT_LOCAL_TASK,
506 510
  );
507 511

  
508 512
  $items['cdm_dataportal/search/taxon_by_description'] = array(
509 513
    'title' => 'By content category', // will be passed through t()
510 514
    'page callback' => 'cdm_dataportal_view_search_taxon_by_description',
511
    'access arguments' => array('access content'),
515
    'access arguments' => array('access cdm content'),
512 516
    'type' => MENU_LOCAL_TASK,
513 517
  );
514 518

  
515 519
  $items['cdm_dataportal/search/results/taxon'] = array(
516 520
    'page callback' => 'cdm_dataportal_view_search_results_taxon',
517
    'access arguments' => array('access content'),
521
    'access arguments' => array('access cdm content'),
518 522
    'type' => MENU_CALLBACK,
519 523
  );
520 524
  /*
521 525
   $items['cdm/xml2json'] = array(
522 526
   'page callback' => 'cdm_view_xml2json',
523
   'access arguments' => array('access content'),
527
   'access arguments' => array('access cdm content'),
524 528
   'type' => MENU_CALLBACK,
525 529
   );
526 530
   */
......
529 533
  // User configuration of cdm_dataportal.
530 534
  $items['user/%/cdm_dataportal'] = array(
531 535
    'title' => 'cdm_dataportal',
532
    'access arguments' => array('access content'),
536
    'access arguments' => array('access cdm content'),
533 537
    'page callback' => 'drupal_get_form',
534 538
    'page arguments' => array('cdm_dataportal_user_form'),
535 539
    'type' => MENU_LOCAL_TASK,
......
542 546
    // 'page callback' => 'cdm_dataportal_view_name',
543 547
    'page callback' => 'cdm_dataportal_name_page_view',
544 548
    'page arguments' => array(2, 3, 4),
545
    'access arguments' => array('access content'),
549
    'access arguments' => array('access cdm content'),
546 550
    'type' => MENU_CALLBACK,
547 551
  );
548 552

  
......
553 557
      'title' => '@tabname',
554 558
      'title arguments' => array('@tabname' => theme('cdm_taxonpage_tab', array('tabname' => 'General'))),
555 559
      'page callback' => 'cdm_dataportal_taxon_page_view',
556
      'access arguments' => array('access content'),
560
      'access arguments' => array('access cdm content'),
557 561
      'type' => MENU_CALLBACK,
558 562
      'weight' => 1,
559 563
      'page arguments' => array(2, "description")
......
564 568
      'title' => '@tabname',
565 569
      'title arguments' => array('@tabname' => theme('cdm_taxonpage_tab', array('tabname' => 'General'))),
566 570
      'page callback' => 'cdm_dataportal_taxon_page_view',
567
      'access arguments' => array('access content'),
571
      'access arguments' => array('access cdm content'),
568 572
      'type' => MENU_CALLBACK,
569 573
      'weight' => 2,
570 574
      'page arguments' => array(2, "all")
......
575 579
      'title' => '@tabname',
576 580
      'title arguments' => array('@tabname' => theme('cdm_taxonpage_tab', array('tabname' => 'General'))),
577 581
      'page callback' => 'cdm_dataportal_taxon_page_view',
578
      'access arguments' => array('access content'),
582
      'access arguments' => array('access cdm content'),
579 583
      'type' => MENU_DEFAULT_LOCAL_TASK,
580 584
      'weight' => 2,
581 585
      'page arguments' => array(2, "description")
......
586 590
      'title' => '@tabname',
587 591
      'title arguments' => array('@tabname' => theme('cdm_taxonpage_tab', array('tabname' => 'Synonymy'))),
588 592
      'page callback' => 'cdm_dataportal_taxon_page_view',
589
      'access arguments' => array('access content'),
593
      'access arguments' => array('access cdm content'),
590 594
      'type' => MENU_LOCAL_TASK,
591 595
      'weight' => 4,
592 596
      'page arguments' => array(2, "synonymy", 4)
......
596 600
      'title' => '@tabname',
597 601
      'title arguments' => array('@tabname' => theme('cdm_taxonpage_tab', array('tabname' => 'Images'))),
598 602
      'page callback' => 'cdm_dataportal_taxon_page_view',
599
      'access arguments' => array('access content'),
603
      'access arguments' => array('access cdm content'),
600 604
      'type' => MENU_LOCAL_TASK,
601 605
      'weight' => 5,
602 606
      'page arguments' => array(2, "images")
......
607 611
      'title' => '@tabname',
608 612
      'title arguments' => array('@tabname' => theme('cdm_taxonpage_tab', array('tabname' => 'Specimens'))),
609 613
      'page callback' => 'cdm_dataportal_taxon_page_view',
610
      'access arguments' => array('access content'),
614
      'access arguments' => array('access cdm content'),
611 615
      'type' => MENU_LOCAL_TASK,
612 616
      'weight' => 6,
613 617
      'page arguments' => array(2, "specimens")
......
618 622
      'title' => '@tabname',
619 623
      'title arguments' => array('@tabname' => theme('cdm_taxonpage_tab', array('tabname' => 'Keys'))),
620 624
      'page callback' => 'cdm_dataportal_taxon_page_view',
621
      'access arguments' => array('access content'),
625
      'access arguments' => array('access cdm content'),
622 626
      'type' => MENU_LOCAL_TASK,
623 627
      'weight' => 6,
624 628
      'page arguments' => array(2, "keys")
......
629 633
      'title' => '@tabname',
630 634
      'title arguments' => array('@tabname' => theme('cdm_taxonpage_tab', array('tabname' => 'Experts'))),
631 635
        'page callback' => 'cdm_dataportal_taxon_page_view',
632
        'access arguments' => array('access content'),
636
        'access arguments' => array('access cdm content'),
633 637
        'type' => MENU_LOCAL_TASK,
634 638
        'weight' => 6,
635 639
        'page arguments' => array(2, "experts")
......
638 642

  
639 643
    $items['cdm_dataportal/taxon/autosuggest/%/%/%/'] = array(
640 644
        'page callback' => 'cdm_dataportal_taxon_autosuggest',
641
        'access arguments' => array('access taxon autosuggest'),
645
        'access arguments' => array('access cdm content'),
642 646
        'page arguments' => array(3,4,5),
643 647
        'type' => MENU_CALLBACK
644 648
    );
modules/cdm_dataportal/cdm_taxontree/cdm_taxontree.module
26 26

  
27 27
  $items['cdm_taxontree/set'] = array(
28 28
    'page callback' => 'cdm_taxontree_set',
29
    'access arguments' => array('access content'),
29
    'access arguments' => array('access cdm content'),
30 30
    'type' => MENU_CALLBACK,
31 31
  );
32 32

  
33 33
  $items['cdm_taxontree/filter'] = array(
34 34
    'page callback' => 'cdm_taxontree_view_filter',
35
    'access arguments' => array('access content'),
35
    'access arguments' => array('access cdm content'),
36 36
    'type' => MENU_CALLBACK,
37 37
  );
38 38

  
39 39
  $items['cdm_taxontree/taxonomy/children'] = array(
40 40
    'page callback' => 'cdm_taxontree_taxonomy_children',
41
    'access arguments' => array('access content'),
41
    'access arguments' => array('access cdm content'),
42 42
    'type' => MENU_CALLBACK,
43 43
  );
44 44

  
modules/cdm_dataportal/profile/CDM_Portal/CDM_Portal.install
172 172
  user_role_save($admin_role);
173 173

  
174 174
  // Make sure these permissions are present, e.g. that the modules defining these permissions are installed.
175
  // This because user_role_grant_permissions() will create the permission in the role_permision table if it does not
175
  // This because user_role_grant_permissions() will create the permission in the role_permission table if it does not
176 176
  // exist, and for that it needs to find a module that defines the permission (there is a module column in this table).
177 177
  $permissions = array(
178 178
    'access administration menu',
179 179
    'access administration pages',
180 180
    'access content',
181
    'access cdm content',
181 182
    'access content overview',
182 183
    'access extlinks content',
183 184
    'access site in maintenance mode',
......
221 222
    ->fields(array('uid' => 1, 'rid' => $admin_role->rid))
222 223
    ->execute();
223 224

  
225
  // additional permission for the anonymous user	authenticated user roles
226
  $additional_default_permissions = array(
227
    'access cdm content',
228
    'access extlinks content'
229
  );
230
  user_role_grant_permissions(1, $additional_default_permissions); // anonymous user
231
  user_role_grant_permissions(2, $additional_default_permissions); // authenticated user
232

  
233

  
224 234
  /****************************************
225 235
   *  Blocks
226 236
   ****************************************/

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)