Commit Graph
21 Commits
Author SHA1 Message Date
FOSSBilling BotandFOSSBilling Bot f136352b31 Apply PHP Code Styling & Quality Changes (#1865)
Co-authored-by: FOSSBilling Bot <fossbilling-bot>
2023-11-25 02:55:31 +00:00
Belle Aerni 5bd3ff7751 Begin reworking permission management (#1545)
* Begin reworking permission management

* Tests

* This.. tested functionality that didn't exist in the app

* Fixes

* Added permission checks for the system module

* Implemented extension settings permission

The "extension" settings page will now check for permission before allowing a staff member to even visit the settings page for a client.

FOSSBilling will also check for permission before saving a new config so the API can't be used to bypass this limitation.

I also removed a test as it was checking a function which only ever had one possible return value, no point in updating it to work with this PR

* This should fix the test

* I got a little mixed up with that, but this should work

* Fixed the tests

* Implemented give all & revoke all buttons

* Implemented more, enhancements, & bugfix

* Rename function

* Fix tests

* Optimize, address comment

* Now let's make the tests happy again

* Deduplicate code, cleanup a bit

* Bugfix

* Added selectbox support to the front-end

* Quick bugfix

* Fix issue PHPStan detected

* Bug fix

* Improved page layout & styling

* Implemented more checks

* Fix the tests

* Update error.html.twig

* Cleanup

* Fix the tests

* Updated the design to be more space efficient

* Don't list module access when always given

* Updated the exception type

* setMethod -> onlyMethods

* I donno how that got goofed up

* Fix the test, email module should always be accessible

* Removed the broken test

It's.. not really checking anything anyways. Just that the `extension` module is in a hardcoded array.
2023-11-21 16:18:53 -08:00
Belle Aerni 64edea94c4 Cache extension configs (#1848)
* Cache extension configs

* Adjusted the tests

* Use ArrayAdapter
2023-11-19 01:24:36 +01:00
Belle Aerni 50043e6211 Run Rector against our tests (#1761)
* Update rector config to include tests

* Run Rector against the tests

* Delete test-results

* Update .gitignore

* Correctly set the PHP min to 8.1, split the configs

* Corrected PHPDoc

* Deleted tests we can't really get to pass

PHPunit is hard-coded to fail when a class has a return type of `never`, which is the correct return type of our redirect function (and rightfully so).

No way to disable the exception as far as we can tell
2023-11-11 18:41:09 +00:00
Adam Daley 276df9a58e Update PHPUnit to version 10 (#1798)
* Update PHPUnit to version 10

Update composer and CI version of PHPUnit to 10, and migrate XML config to updated schema.

* Update tests for PHPUnit 10

Update tests to replace depreciated functions in PHPUnit 10. Also, remove risky tests which don't assert anything.
2023-11-09 10:43:30 +01:00
Adam DaleyandBelle Aerni b35b2efc52 Merge Kb and Support modules (#1180)
* Merge Kb and Support modules

Merge the Kb and Support modules as they contain related functionality.

* General improvements to Support module UI

Update Support module copy and navigation to be more consistent, and other general improvements.

* This was missed.. and now it's not 😉

---------

Co-authored-by: Belle Aerni <belleaerni@gmail.com>
2023-11-06 04:10:09 +00:00
Belle Aerni 602b537996 Opt-in error reporting via Sentry.io (#1732)
* Began implementing Sentry.io support

* Added to the installer

* Added the ID to the bug report template and UI

* Hook it into our error handler, added the ability to filter by error code

* Attempting to add the DSN via GH actions

* Spelling and making PHPstan happy

* Skip exceptions for various incomplete configurations

Also brings in some of the category suggestions made by @Anuril in #195

* Update tests to account for changes

* Added & renamed exception classes

* Fix tests

* Change a bunch of items to be InformationExceptions

* Use a lighter HTTP client, fixed API error reporting

* I guess that's not needed now?

Arighty then

* Improvements, additional info added

* Update SentryHelper.php

* Improved error logging, added instance ID to error page

Also made it so that errors are correctly sent to Sentry rather than exclusively exceptions

* Make the tests happy

* Added the link, improved wording

Also removed the "performance" part of the reporting as it needs to be added to the front-end and I'm not currently implementing that

* Began implementing UI alerts and info

* Added the ability to toggle, fixed tests, use path constants

* Added some useful info & links to the page

* These should be InformationException

* Fix the automated Sentry DSN entry

* Fix the install number text

* Minor cleanup, converted more to InformationException

* Replaced some direct config references with constants

We have the BB_DEBUG constant to indicate if we have debug mode enabled or not, so we shouldn't be directly referencing it in the config file unless we actually need to do so.

Using the constant means there's less locations to update the reference if the config structure is changed

* Bugfix

* Consistency & fixed a PHPDoc

* Corrections

* We actually do want exceptions thrown here

* Change how we get the instance ID

* Stability improvements

Having support for translatable error pages was proving to be problematic, so I had to remove it.

I also had to update the exception class to handle cases where the trans function wasn't setup yet (needed for the /run-patcher page if an error occurs)

* Missed this change on git

* Also fix the variable names...

* Re-added new deps after rebase

* This should also accept "Error" types

* Added more info to the bug report and removed a dug line

* This wasn't supposed to get renamed

* Updated some missed references to Box_Exception
2023-10-28 18:40:39 -07:00
Adam Daley e54569d2cd Introduce namespaces and strict typing for FOSSBilling library classes (#1206) 2023-05-04 01:02:06 +01:00
Adam Daley 053f22a8bb Remove Box DI class in favour of native dependencies (#1193) 2023-04-30 08:47:52 +01:00
Adam Daley d4e4207d83 Update locations with extension manager naming (#1169)
Update remaining locations with new `extension_manager` naming.
2023-04-26 02:46:56 +02:00
YağızhanandAdam Daley 63d5847da2 New ExtensionDirectory class (#1141)
* Caught a typo

* New ExtensionDirectory class

* Tests

* Tests and error handling

* Stuff

* Literally the same outcome anyway. Will write this in the future.

* Removed tests for a function that does nothing

* "stable" -> "release"

* Fix misnamed exception errors

* Update class name to ExtensionManager

---------

Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
2023-04-22 23:45:24 +01:00
Yağızhan 98b8a804ab Minor changes to the extension directory templates (#1130) 2023-04-22 14:24:52 +03:00
Adam Daley 69193e402f Remove Box/Zip in favour of library (#1123)
Remove custom Box/Zip class in favour of nelexa/zip library.
2023-04-22 07:21:34 +02:00
Adam Daley a2abdbddfa Refactor Box/Tools to remove unnecessary functions (#1115)
* Refactor Box/Tools to remove unnecessary functions

Refactor Box/Tools to remove functions which essentially duplicate PHP functionality, or provide a thin wrapper around such functions.

* Move config migrate/update to relevant class

Move config update functionality from Box/Tools to Box/Update.

* Move Gravatar function to class where used

Moved Gravatar function to Twig filter where it is used, rather than in a custom Box/Tool function.
2023-04-17 20:48:49 -07:00
Belle Aerni 9faa981c58 Replace usage of array_get (#989)
* Replace usage of array_get

* Fixes

* And a few more

* Remove remaining references

* Update Service.php

* Few more fixes

* Fix.. I think?

* Fix Client / Invoice updates

* Fix stats

* Fix issues noticed during code review

* More fixes

* And some more fixes :)
2023-03-27 23:44:30 -07:00
Belle Aerni 789189c24e Fix downloading extensions (#979)
* Fix extension downloading & cleanup functionality

* Update ServiceTest.php
2023-03-23 21:50:56 +00:00
Adam de0bed20ec Replace various HTTP client implementations with symfony/http-client (#861)
* Replace guzzlehttp/guzzle with symfony/http-client

Replace guzzlehttp/guzzle with symfony/http-client to standardise around one globally available HTTP client.

* Replace Box\Curl library and native cURL with symfony/http-client

Replace the Box\Curl library and native cURL with symfony/http-client to standardise around one well supported HTTP client, reduce unnecessary code, and improve compatibility.

* Remove obsolete functionality from Spamchecker module

Remove obsolete functions from Spamchecker module which depended upon cURL.
2023-03-15 11:11:28 +01:00
Adam 11a1906ee7 Fix broken module tests (#867)
* Fix typo in Email module tests

Fix missing semicolon in tests for Email module causing PHPUnit to fail.

* Fix module test errors due to RedBean

Fix module tests causing error due to RedBean when being mocked in PHPUnit.

* Fix module test failures

Update module tests to fix failures, and remove obsoleted tests causing failure.
2023-02-27 10:38:20 -08:00
Belle Aerni 7ecaf786d5 Move RedBeanPHP to composer (#767)
* Move RedBeanPHP to composer

* Remove missed references to rb.php

* This *should* fix the tests

* Update DummyBean.php

* Remove payment adapter tests

They.. honestly didn't test much and are proving to cause issues when moving rb.php to composer
2023-02-05 08:43:37 -08:00
Belle Aerni ee676ca33a Update file references 2022-11-28 17:22:50 +03:00
Belle Aerni edd6f72634 Drop the "BB" prefix 2022-11-28 17:22:50 +03:00