@@ -60,12 +60,9 @@ function taskAction()
60
60
if (!$ this ->logged )
61
61
{
62
62
$ this ->haveToBeLogged ();
63
- return ;
64
- }
65
- if (!$ this ->userSession ->Dao ->getAdmin () == 1 )
66
- {
67
- throw new Zend_Exception ("You should be an administrator " );
63
+ return false ;
68
64
}
65
+ $ this ->requireAdminPrivileges ();
69
66
70
67
$ task = $ this ->_getParam ("task " );
71
68
$ params = $ this ->_getParam ("params " );
@@ -87,12 +84,9 @@ function indexAction()
87
84
if (!$ this ->logged )
88
85
{
89
86
$ this ->haveToBeLogged ();
90
- return ;
91
- }
92
- if (!$ this ->userSession ->Dao ->getAdmin () == 1 )
93
- {
94
- throw new Zend_Exception ("You should be an administrator " );
87
+ return false ;
95
88
}
89
+ $ this ->requireAdminPrivileges ();
96
90
$ this ->view ->header = "Administration " ;
97
91
$ configForm = $ this ->Form ->Admin ->createConfigForm ();
98
92
@@ -306,10 +300,7 @@ function indexAction()
306
300
/** Used to display and filter the list of log messages */
307
301
function showlogAction ()
308
302
{
309
- if (!$ this ->logged || !$ this ->userSession ->Dao ->getAdmin () == 1 )
310
- {
311
- throw new Zend_Exception ("You should be an administrator " );
312
- }
303
+ $ this ->requireAdminPrivileges ();
313
304
$ this ->requireAjaxRequest ();
314
305
$ this ->_helper ->layout ->disableLayout ();
315
306
@@ -387,10 +378,7 @@ function showlogAction()
387
378
/** Used to delete a list of log entries */
388
379
function deletelogAction ()
389
380
{
390
- if (!$ this ->logged || !$ this ->userSession ->Dao ->getAdmin () == 1 )
391
- {
392
- throw new Zend_Exception ('You should be an administrator ' );
393
- }
381
+ $ this ->requireAdminPrivileges ();
394
382
$ this ->requireAjaxRequest ();
395
383
$ this ->_helper ->layout ->disableLayout ();
396
384
$ this ->_helper ->viewRenderer ->setNoRender ();
@@ -416,10 +404,7 @@ function deletelogAction()
416
404
/** function dashboard*/
417
405
function dashboardAction ()
418
406
{
419
- if (!$ this ->logged || !$ this ->userSession ->Dao ->getAdmin () == 1 )
420
- {
421
- throw new Zend_Exception ("You should be an administrator " );
422
- }
407
+ $ this ->requireAdminPrivileges ();
423
408
$ this ->requireAjaxRequest ();
424
409
425
410
$ this ->_helper ->layout ->disableLayout ();
@@ -433,10 +418,7 @@ function dashboardAction()
433
418
/** upgrade database*/
434
419
function upgradeAction ()
435
420
{
436
- if (!$ this ->logged || !$ this ->userSession ->Dao ->getAdmin () == 1 )
437
- {
438
- throw new Zend_Exception ("You should be an administrator " );
439
- }
421
+ $ this ->requireAdminPrivileges ();
440
422
$ this ->requireAjaxRequest ();
441
423
$ this ->_helper ->layout ->disableLayout ();
442
424
@@ -500,12 +482,10 @@ function serversidefilechooserAction()
500
482
{
501
483
if (!$ this ->logged )
502
484
{
503
- throw new Zend_Exception ("You should be logged in " );
504
- }
505
- if (!$ this ->userSession ->Dao ->isAdmin ())
506
- {
507
- throw new Zend_Exception ("Administrative privileges required " );
485
+ $ this ->haveToBeLogged ();
486
+ return false ;
508
487
}
488
+ $ this ->requireAdminPrivileges ();
509
489
510
490
$ this ->_helper ->layout ->disableLayout ();
511
491
$ this ->_helper ->viewRenderer ->setNoRender ();
@@ -571,12 +551,9 @@ function migratemidas2Action()
571
551
if (!$ this ->logged )
572
552
{
573
553
$ this ->haveToBeLogged ();
574
- return ;
575
- }
576
- if (!$ this ->userSession ->Dao ->getAdmin () == 1 )
577
- {
578
- throw new Zend_Exception ("You should be an administrator " );
554
+ return false ;
579
555
}
556
+ $ this ->requireAdminPrivileges ();
580
557
581
558
$ this ->assetstores = $ this ->Assetstore ->getAll ();
582
559
$ this ->view ->migrateForm = $ this ->Form ->Migrate ->createMigrateForm ($ this ->assetstores );
0 commit comments