FOSSology  4.4.0
Open Source License Compliance by Open Source Software
createUIUsers.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2011 Hewlett-Packard Development Company, L.P.
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
19 require_once ('fossologyTestCase.php');
20 require_once ('TestEnvironment.php');
21 
22 global $URL;
23 
25 
26  public $mybrowser;
27  public $webProxy;
28  protected $roUserFolderId;
29  protected $rwUserFolderId;
30  protected $uploaderFolderId;
31  protected $analyzeFolderId;
32  protected $downLoaderFolderId;
33 
34  function setUp() {
35 
36  global $URL;
37 
38  $this->Login();
39  // create folders for the simple ui users
40  $this->roUserFolderId = $this->createFolder(1, 'rouser',
41  'Read only User folder');
42  $this->downLoaderFolderId = $this->createFolder(1, 'downloader',
43  'downloader User folder');
44  $this->rwUserFolderId = $this->createFolder(1, 'rwuser',
45  'Read/Write User folder');
46  $this->uploaderFolderId = $this->createFolder(1, 'uploader',
47  'Uploader User folder');
48  $this->analyzeFolderId = $this->createFolder(1, 'anauser',
49  'Analyze User folder');
50  }
51 
52  function testcreateUiUsers() {
53 
54  global $URL;
55 
56  // fields are:
57  // User, Desc, email, access, folder, block, blank, password, Enote, bucket
58  // ui
59  $simple = 'simple';
60  $orig = 'original';
61  $Users = array(
62  'fosstester' =>
63  "Primary Test User: runs test suites,fosstester,10,1,NULL,NULL,
64  fosstester,y,1,$orig",
65  'noemail' =>
66  "test user with NO Email notification,NULL,10,1,NULL,NULL,noemail,NULL,
67  1,$orig",
68  'jenkins' =>
69  "Jenkins user for test runs started from jenkins,NULL,10,1,NULL,NULL,
70  jenkins,y,1,$orig",
71  'rouser' =>
72  "Read only User: simple Ui,NULL,1,$this->roUserFolderId,NULL,NULL,'',
73  NULL,1,$simple",
74  'downloader' =>
75  "download user: simple ui,NULL,2,$this->downLoaderFolderId,NULL,NULL,'',
76  NULL,1,$simple",
77  'rwuser' =>
78  "read/write user: simple ui,NULL,3,$this->rwUserFolderId,NULL,NULL,'',
79  NULL,1,$simple",
80  'uploader' =>
81  "upload user: simple ui,NULL,4,$this->uploaderFolderId,NULL,NULL,'',
82  NULL,1,$simple",
83  'rwuser' =>
84  "read/write user: simple ui,NULL,5,$this->analyzeFolderId,NULL,NULL,'',
85  NULL,1,$simple",
86  );
87 
88  $Svn = `svnversion`;
89  $date = date('Y-m-d');
90  $time = date('h:i:s-a');
91  print "Starting testcreateUIUsers on: " . $date . " at " . $time . "\n";
92  print "Using Svn Version:$Svn\n";
93  foreach($Users as $user => $params) {
94  list($description, $email, $access, $folder,
95  $block, $blank, $password, $Enote, $bucket, $ui ) = explode(',',$Users[$user]);
96  $added = $this->addUser($user, $description, $email, $access, $folder,
97  $password, $Enote, $bucket, $ui);
98  if(preg_match('/User already exists/',$added, $matches)) {
99  $this->pass();
100  continue;
101  }
102  if(!empty($added)) {
103  $this->fail("User $user was not added to the fossology database\n$added\n");
104  }
105  }
106  }
107 }
addUser($UserName, $Description=NULL, $Email=NULL, $Access=1, $Folder=1, $Password=NULL, $EmailNotify='y')
createFolder($parent, $name, $description=null)
Login($User=NULL, $Password=NULL)
list_t type structure used to keep various lists. (e.g. there are multiple lists).
Definition: nomos.h:308