Skip to content

Commit 0e34a45

Browse files
committed
testing
1 parent a1679de commit 0e34a45

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1603
-36268
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Set up PHP
3030
uses: shivammathur/setup-php@v2
3131
with:
32-
php-version: "7.4"
32+
php-version: "8.3"
3333
coverage: none
3434
tools: phpcs
3535

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,8 @@ composer.lock
1616
deployment/*
1717
!deployment/**/README.md
1818
!deployment/deploy.sh
19+
20+
# these files are generated by a python script
21+
tools/docker-dev/identity/bootstrap.ldif
22+
tools/docker-dev/web/htpasswd
23+
tools/docker-dev/sql/bootstrap-users.sql

CONTRIBUTING.md

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,26 @@ When submitting pull requests, the pull request should be made to the version yo
88

99
## Conventions
1010

11-
This code base is currently using PHP version 7.4. All files are required to be linted with PSR-12 standard. This repository will automatically check PRs for linting compliance.
11+
This code base is currently using PHP version 8.3. All files are required to be linted with PSR-12 standard. This repository will automatically check PRs for linting compliance.
12+
13+
### handling HTTP headers
14+
15+
* the web page header `LOC_HEADER` should be included before handling HTTP headers
16+
* all expected headers should be fetched using `UnitySite::array_get_or_bad_request`
17+
* all headers which are expected to be one of a set of hard coded values should use a switch case where the default case is `UnitySite::bad_request("invalid <header-name>")`
18+
19+
### admin access control
20+
21+
All pages under `admin/` should check `$USER->isAdmin()` and do `UnitySite::forbidden($USER, $SQL)` if not admin. This should be redundant since the web server should also be doing this on `admin/` as a whole.
22+
23+
### error messages
24+
25+
Use `UnitySite::alert` to make a popup. Be sure to break out of whatever logic branch you're in.
26+
27+
### die()
28+
29+
Don't use `die()`. Throw an exception.
30+
1231

1332
## Development Environment
1433

@@ -29,26 +48,12 @@ While the environment is running, the following is accessible:
2948

3049
### Test Users
3150

32-
The test environment ships with a number of users that can be used for testing. When accessing locked down portions of the portal, you will be asked for a username and password. The password is always `password`.
33-
3451
The following users are available for testing:
3552

36-
* `[email protected]` - admin user who is a member of pi_user1_domain_edu
37-
* `[email protected]` - admin user
38-
* `[email protected]` - user who is the owner of pi_user1_domain_edu
39-
* `[email protected]` - user who is the owner of pi_user2_domain_edu
40-
* `[email protected]` - user who is a member of pi_user1_domain_edu
41-
42-
* `[email protected]` - user who is a member of pi_user2_domain_edu
43-
* `[email protected]` - user who is a member of pi_user2_domain_edu
44-
* `[email protected]` - user who has no LDAP object
45-
* `[email protected]` - user who has no LDAP object
46-
* `[email protected]` - user who has no LDAP object
47-
* `[email protected]` - user who is the owner of pi_user1_domain2_edu
48-
49-
* `[email protected]` - user who has no LDAP object
50-
* `[email protected]` - user who has no LDAP object
53+
* `[email protected]` - portal administrator, also has PI group `pi_web_admin_unityhpc_test`
54+
55+
The test environment ships with a randomly generated (with hard coded seed) set of organizations, PI groups, and user accounts. See `tools/docker-dev/generate-user-bootstrap-files-.py`. Use PHPLDAPAdmin to view them. The UIDs are of the form `user0001_org01_test`, `user0002_org02_test`, ... . The lowest user numbers are deliberatly left out, so that you can test the creation of new users. To log in as a user, you can clear your cookies and do HTTP basic auth with their `mail` attribute and password "password", or you can log in as `web_admin` and switch to their account from the user management page.
5156

5257
### Changes to Dev Environment
5358

54-
Should the default schema of the web portal change, the `ldap/bootstrap.ldif` and `sql/bootstrap.sql` must be updated for the LDAP server and the MySQL server, respectively.
59+
Should the default schema of the web portal change, `tools/generate_htpasswd_bootstrap-ldif.py` and `sql/bootstrap.sql` must be updated for the LDAP server and the MySQL server, respectively.

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,18 @@ Unity Web Portal is a PHP application built in top of MariaDB and LDAP which act
2222
1. Composer (`apt install composer` on Ubuntu)
2323
1. PHP Extensions
2424
1. `php-ldap`
25-
2. `php-curl`
26-
3. `php-redis`
27-
4. `php-cli`
28-
5. `php-mysql`
29-
6. `php-pdo`
30-
2. Composer packages
25+
1. `php-curl`
26+
1. `php-redis`
27+
1. `php-cli`
28+
1. `php-mysql`
29+
1. `php-pdo`
30+
1. Composer packages
3131
1. `cd` to this repository
32-
2. Install packages `composer update`
33-
3. Setup config file `config/config.ini` according to your site deployment
34-
4. Setup branding file `config/branding/config.ini` according to your site deployment
35-
5. Point your web server's document root to `webroot` in this repo
32+
1. Install packages `sudo composer update --no-plugins --no-scripts`
33+
1. Deployment:
34+
1. configure the files in `deployment/` according to their respective `README.md` files
35+
1. make sure redis cache is populated: `cd workers && php ./update-ldap-cache.php`
36+
1. Point your web server's document root to `webroot` in this repo
3637

3738
The scope of this project ends at being responsible for the LDAP user database. We recommend production deployments to set up scripts which detect changes in LDAP and then perform further actions. For example, a script can be used to create Slurm scheduler accounting roles based on the LDAP information created by this website.
3839

@@ -46,7 +47,7 @@ The update process is similar to the installation process:
4647

4748
1. Clone the release and follow installation instructions 1 and 2 from above.
4849
2. Copy the following folders from the old installation to the new one:
49-
1. `config`
50+
1. `deployment`
5051
2. `webroot/assets/footer_logos`
5152

5253
We recommend a deployment where each version of the portal is its own clone, then just change a symlink to point to the new version. This way a rollback is much easier.

composer.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
22
"require": {
3-
"psr/log": "1.1.4",
4-
"phpseclib/phpseclib": "3.0.16",
5-
"phpmailer/phpmailer": "6.6.4",
6-
"hakasapl/phpopenldaper": "1.0.5"
3+
"psr/log": ">=3.0.2",
4+
"phpseclib/phpseclib": ">=3.0.43",
5+
"phpmailer/phpmailer": ">=6.9.3",
6+
"hakasapl/phpopenldaper": ">=1.0.5",
7+
"mockery/mockery": ">=1.6.12",
8+
"phpunit/phpunit": "<12.1"
79
}
810
}

0 commit comments

Comments
 (0)