aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin Popov <info@valentineus.link>2018-06-11 10:58:13 +0300
committerValentin Popov <info@valentineus.link>2018-06-11 10:58:13 +0300
commitbb3d858da5b4c766f0f5fca5baead75993a6197a (patch)
treeb11cba05516bb6ab2389aa96b4ba33846a2cd075
parent7d3c303af868bb18f4561534f7ac37f5f4f3e69b (diff)
downloadtool_apisiteadmins-bb3d858da5b4c766f0f5fca5baead75993a6197a.tar.xz
tool_apisiteadmins-bb3d858da5b4c766f0f5fca5baead75993a6197a.zip
Description of the plugin
Signed-off-by: Valentin Popov <info@valentineus.link>
-rw-r--r--README.md120
1 files changed, 120 insertions, 0 deletions
diff --git a/README.md b/README.md
index e69de29..ffc4597 100644
--- a/README.md
+++ b/README.md
@@ -0,0 +1,120 @@
+# Advanced API administration management
+
+The plug-in extends and complements the system API for managing administrators.
+Main library is well documented and tested.
+Can be used by third-party developers for development.
+
+In addition, the plugin adds functions for
+[Web services](https://docs.moodle.org/dev/Web_services)
+that interact with the list of administrators.
+For documentation on Web services, see Moodle:
+`https://example.domain/admin/webservice/documentation.php`
+
+## Installation
+
+Get the installation package in any of the available methods:
+
+* [GitHub Releases](https://github.com/valentineus/moodle-tool_apisiteadmins/releases).
+* [Compilation from the source code](#build).
+
+In Moodle in the administration panel go to the "Plugins" section and make a
+standard installation of the plug-in.
+
+## Testing
+
+* Perform the installation of `PHPUnit` and configure the test environment.
+Use the
+[official guide](https://docs.moodle.org/dev/PHPUnit#Installation_of_PHPUnit_via_Composer)
+for detailed information.
+
+* To run the plugin test, use the following commands:
+
+```bash
+# Run all tests
+php vendor/bin/phpunit --testdox --group tool_apisiteadmins
+
+# Or running individual tests
+php vendor/bin/phpunit --testdox tool_apisiteadmins_api_testcase admin/tool/apisiteadmins/tests/api_test.php
+php vendor/bin/phpunit --testdox tool_apisiteadmins_external_testcase admin/tool/apisiteadmins/tests/external_test.php
+```
+
+## Build
+
+Self-assembly package is as follows:
+
+* Clone the repository:
+
+```bash
+git clone https://github.com/valentineus/moodle-tool_apisiteadmins.git apisiteadmins
+```
+
+* Run the build script:
+
+```bash
+cd ./apisiteadmins
+/bin/sh build.sh
+```
+
+## API
+
+### tool_apisiteadmins::add_user( $userid ) ⇒`Boolean`
+
+Adds a user to the list of administrators.
+
+| Param | Type | Description |
+| ------- | -------- | -------------- |
+| $userid | `Number` | System user ID |
+
+Example:
+
+```php
+require_once($CFG->dirroot . "/admin/tool/apisiteadmins/lib.php");
+
+$userid = 2;
+tool_apisiteadmins::add_user($userid);
+// result: true
+```
+
+### tool_apisiteadmins::remove_user( $userid ) ⇒`Boolean`
+
+Removes a user from the list of administrators.
+
+| Param | Type | Description |
+| ------- | -------- | -------------- |
+| $userid | `Number` | System user ID |
+
+Example:
+
+```php
+require_once($CFG->dirroot . "/admin/tool/apisiteadmins/lib.php");
+
+$userid = 2;
+tool_apisiteadmins::remove_user($userid);
+// result: true
+```
+
+### tool_apisiteadmins::set_main( $userid ) ⇒`Boolean`
+
+Registers the user as the primary administrator.
+
+| Param | Type | Description |
+| ------- | -------- | -------------- |
+| $userid | `Number` | System user ID |
+
+Example:
+
+```php
+require_once($CFG->dirroot . "/admin/tool/apisiteadmins/lib.php");
+
+$userid = 2;
+tool_apisiteadmins::set_main($userid);
+// result: true
+```
+
+## License
+
+<img height="256px" alt="GNU Banner" src="https://www.gnu.org/graphics/runfreegnu.png" />
+
+[GNU GPLv3](LICENSE.txt).
+Copyright (c)
+[Valentin Popov](mailto:info@valentineus.link).