FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
createUIUsers.php
1 <?php
2 /***********************************************************
3  Copyright (C) 2011 Hewlett-Packard Development Company, L.P.
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU General Public License
7  version 2 as published by the Free Software Foundation.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License along
15  with this program; if not, write to the Free Software Foundation, Inc.,
16  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  ***********************************************************/
18 
30 require_once ('fossologyTestCase.php');
31 require_once ('TestEnvironment.php');
32 
33 global $URL;
34 
36 
37  public $mybrowser;
38  public $webProxy;
39  protected $roUserFolderId;
40  protected $rwUserFolderId;
41  protected $uploaderFolderId;
42  protected $analyzeFolderId;
43  protected $downLoaderFolderId;
44 
45  function setUp() {
46 
47  global $URL;
48 
49  $this->Login();
50  // create folders for the simple ui users
51  $this->roUserFolderId = $this->createFolder(1, 'rouser',
52  'Read only User folder');
53  $this->downLoaderFolderId = $this->createFolder(1, 'downloader',
54  'downloader User folder');
55  $this->rwUserFolderId = $this->createFolder(1, 'rwuser',
56  'Read/Write User folder');
57  $this->uploaderFolderId = $this->createFolder(1, 'uploader',
58  'Uploader User folder');
59  $this->analyzeFolderId = $this->createFolder(1, 'anauser',
60  'Analyze User folder');
61  }
62 
63  function testcreateUiUsers() {
64 
65  global $URL;
66 
67  // fields are:
68  // User, Desc, email, access, folder, block, blank, password, Enote, bucket
69  // ui
70  $simple = 'simple';
71  $orig = 'original';
72  $Users = array(
73  'fosstester' =>
74  "Primary Test User: runs test suites,fosstester,10,1,NULL,NULL,
75  fosstester,y,1,$orig",
76  'noemail' =>
77  "test user with NO Email notification,NULL,10,1,NULL,NULL,noemail,NULL,
78  1,$orig",
79  'jenkins' =>
80  "Jenkins user for test runs started from jenkins,NULL,10,1,NULL,NULL,
81  jenkins,y,1,$orig",
82  'rouser' =>
83  "Read only User: simple Ui,NULL,1,$this->roUserFolderId,NULL,NULL,'',
84  NULL,1,$simple",
85  'downloader' =>
86  "download user: simple ui,NULL,2,$this->downLoaderFolderId,NULL,NULL,'',
87  NULL,1,$simple",
88  'rwuser' =>
89  "read/write user: simple ui,NULL,3,$this->rwUserFolderId,NULL,NULL,'',
90  NULL,1,$simple",
91  'uploader' =>
92  "upload user: simple ui,NULL,4,$this->uploaderFolderId,NULL,NULL,'',
93  NULL,1,$simple",
94  'rwuser' =>
95  "read/write user: simple ui,NULL,5,$this->analyzeFolderId,NULL,NULL,'',
96  NULL,1,$simple",
97  );
98 
99  $Svn = `svnversion`;
100  $date = date('Y-m-d');
101  $time = date('h:i:s-a');
102  print "Starting testcreateUIUsers on: " . $date . " at " . $time . "\n";
103  print "Using Svn Version:$Svn\n";
104  foreach($Users as $user => $params) {
105  list($description, $email, $access, $folder,
106  $block, $blank, $password, $Enote, $bucket, $ui ) = split(',',$Users[$user]);
107  $added = $this->addUser($user, $description, $email, $access, $folder,
108  $password, $Enote, $bucket, $ui);
109  if(preg_match('/User already exists/',$added, $matches)) {
110  $this->pass();
111  continue;
112  }
113  if(!empty($added)) {
114  $this->fail("User $user was not added to the fossology database\n$added\n");
115  }
116  }
117  }
118 }
119 ?>
createFolder($parent=null, $name, $description=null)
addUser($UserName, $Description=NULL, $Email=NULL, $Access=1, $Folder=1, $Password=NULL, $EmailNotify= 'y')
list_t type structure used to keep various lists. (e.g. there are multiple lists).
Definition: nomos.h:321
Login($User=NULL, $Password=NULL)