import
[web.mtrack] / bin / acl-check.php
1 <?php # vim:ts=2:sw=2:et:
2 /* For licensing and copyright terms, see the file named LICENSE */
3
4 if (function_exists('date_default_timezone_set')) {
5   date_default_timezone_set('UTC');
6 }
7
8 include dirname(__FILE__) . '/../inc/common.php';
9
10 /* user object right... */
11
12 array_shift($argv);
13 $user = array_shift($argv);
14 MTrackAuth::su($user);
15 $objectid = array_shift($argv);
16
17 /* A bit ugly to have this special case */
18 if ($objectid == '--repo') {
19   $reponame = array_shift($argv);
20   $obj = MTrackRepo::loadByName($reponame);
21   $objectid = "repo:$obj->repoid";
22 }
23
24 $res = MTrackACL::hasAnyRights($objectid, $argv);
25
26 if ($res) {
27   exit(0);
28 }
29 exit(1);
30