11 require_once(
"$MODDIR/lib/php/common-cli.php");
15 error_reporting(E_NOTICE & E_STRICT);
17 $Usage =
"Usage: " . basename($argv[0]) .
" [options]
18 --username = user name
20 --groupname = a group the user belongs to (default active group)
21 --uploadId = id of upload
22 --destgroup = group which will become admin of the upload\n";
26 $opts = getopt(
"hc:", array(
"username:",
"groupname:",
"uploadId:",
"password:",
"destgroup:"));
27 if (array_key_exists(
'h', $opts)) {
32 if (!array_key_exists(
"uploadId", $opts)) {
33 echo
"no uploadId supplied\n";
36 if (!array_key_exists(
"destgroup", $opts)) {
37 echo
"no destgroup supplied\n";
40 $uploadId = $opts[
"uploadId"];
42 $user = array_key_exists(
"username", $opts) ? $opts[
"username"] :
'';
43 $group = array_key_exists(
"groupname", $opts) ? $opts[
"groupname"] :
'';
44 $passwd = array_key_exists(
"password", $opts) ? $opts[
"password"] :
null;
48 $userId = $SysConf[
'auth'][
'UserId'];
49 $groupId = $SysConf[
'auth'][
'GroupId'];
52 $userDao = $GLOBALS[
'container']->get(
"dao.user");
53 $destGroupId = $userDao->getGroupIdByName($opts[
"destgroup"]);
56 $uploadpermDao = $GLOBALS[
'container']->get(
"dao.upload.permission");
57 $uploadpermDao->makeAccessibleToGroup($uploadId, $destGroupId);
account_check(&$user, &$passwd, &$group="")
check if this account is correct
cli_Init()
Initialize the fossology environment for CLI use. This routine loads the plugins so they can be use b...