mirror of
https://github.com/nextcloud/documentation.git
synced 2026-01-03 10:20:02 +07:00
removed remote and public because of faulty core implementations
This commit is contained in:
@@ -1,63 +0,0 @@
|
||||
.. _granting_access:
|
||||
|
||||
Granting Access to your App
|
||||
===========================
|
||||
|
||||
ownCloud's architecture has two major interfaces for apps that need to deal
|
||||
with access beyond the web browser or authenticated users: ``public.php``
|
||||
and ``remote.php`` serve this purpose.
|
||||
|
||||
Public Sharing
|
||||
--------------
|
||||
|
||||
The file ``public.php`` is used for *public sharing* like public file sharing,
|
||||
public gallery sharing and public calendar sharing.
|
||||
|
||||
To register an app for ``public.php`` you just have to put the following lines
|
||||
into your app’s ``appinfo/info.xml``.
|
||||
|
||||
Example from our source code::
|
||||
|
||||
<public>
|
||||
<calendar>share.php</calendar>
|
||||
<caldav>share.php</caldav>
|
||||
</public>
|
||||
|
||||
Now you can reach the file ``/apps/calendar/share.php`` through
|
||||
``/public.php?service=calendar`` and through ``/public.php?service=caldav``.
|
||||
In a more abstract description, given this snippet::
|
||||
|
||||
<public>
|
||||
<servicename>phpfileforsharing.php</servicename>
|
||||
</public>
|
||||
|
||||
you can reach the file ``/apps/appid/phpfileforsharing.php`` by calling
|
||||
``/public.php?service=servicename``.
|
||||
|
||||
Remote Services
|
||||
---------------
|
||||
|
||||
Sometimes apps provide specific protocols that can be handled via HTTP, but are
|
||||
meant to be used with native applications, such as WebDAV (file manager), CalDAV
|
||||
(calendar), CardDAV (address book) and Ampache (media player) rather than the
|
||||
web browser itself. Such services can be exposed via the ``remote.php``
|
||||
interface.
|
||||
|
||||
To register an app for ``remote.php`` you just have use your app's
|
||||
``appinfo/info.xml``, along the lines of the ``public.php`` syntax::
|
||||
|
||||
<remote>
|
||||
<calendar>appinfo/remote.php</calendar>
|
||||
<caldav>appinfo/remote.php</caldav>
|
||||
</remote>
|
||||
|
||||
Now you can reach the file ``/apps/calendar/appinfo/remote.php`` through
|
||||
``/remote.php/calendar`` and through ``/remote.php/caldav/``. Again, with
|
||||
a more abstract syntax, this means that the snippet::
|
||||
|
||||
<remote>
|
||||
<servicename>phpfileforremote.php</servicename>
|
||||
</remote>
|
||||
|
||||
will grant access to ``/apps/appid/phpfileforremote.php`` through
|
||||
``/remote.php/servicename/``.
|
||||
@@ -17,7 +17,6 @@ App Developement
|
||||
static
|
||||
unittesting
|
||||
middleware
|
||||
access
|
||||
externalapi
|
||||
filesystem
|
||||
hooks
|
||||
|
||||
@@ -4,7 +4,7 @@ Middleware
|
||||
.. sectionauthor:: Bernhard Posselt <nukeawhale@gmail.com>
|
||||
|
||||
|
||||
Middleware is logic that is run before and after each request. It offers the following hooks:
|
||||
Middleware is logic that is run before and after each request and is modelled after `Django's Middleware system <https://docs.djangoproject.com/en/dev/topics/http/middleware/>`_. It offers the following hooks:
|
||||
|
||||
* **beforeController**: This is executed before a controller method is being executed. This allows you to plug additional checks or logic before that method, like for instance security checks
|
||||
* **afterException**: This is being run when either the beforeController method or the controller method itself is throwing an exception. The middleware is asked in reverse order to handle the exception and to return a response. If the response is null, it is assumed that the exception could not be handled and the error will be thrown again
|
||||
@@ -26,7 +26,7 @@ To generate your own middleware, simply inherit from the Middleware class :php:c
|
||||
private $api;
|
||||
|
||||
/**
|
||||
* @param API $api: an instance of the api
|
||||
* @param API $api an instance of the api
|
||||
*/
|
||||
public function __construct($api){
|
||||
$this->api = $api;
|
||||
@@ -34,7 +34,7 @@ To generate your own middleware, simply inherit from the Middleware class :php:c
|
||||
|
||||
|
||||
/**
|
||||
* @brief this replaces "fuck" with "****"" in the output
|
||||
* this replaces "fuck" with "****"" in the output
|
||||
*/
|
||||
public function beforeOutput($controller, $methodName, $output){
|
||||
return str_replace($output, 'fuck', '****');
|
||||
@@ -44,7 +44,7 @@ To generate your own middleware, simply inherit from the Middleware class :php:c
|
||||
|
||||
To activate the middleware, you have to overwrite the :php:class:`OCA\\AppFramework\\Middleware\\MiddlewareDispatcher`: in the DIContainer constructor:
|
||||
|
||||
.. note:: If you ship your own middleware, be sure to also enable the existing ones if you overwrite the MiddlewareDispatcher in the Dependency Injection Container!
|
||||
.. note:: If you ship your own middleware, be sure to also enable the existing ones like the **SecurityMiddleware** if you overwrite the MiddlewareDispatcher in the Dependency Injection Container! **If this is forgotten, there will be security issues**!
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
@@ -65,4 +65,4 @@ To activate the middleware, you have to overwrite the :php:class:`OCA\\AppFramew
|
||||
|
||||
.. note::
|
||||
|
||||
The order is important! The middleware that is registered first gets run first in the beforeController method. For all other hooks, the order is being reversed, meaning: if something is defined first, it gets run last.
|
||||
The order is important! The middleware that is registered first gets run first in the **beforeController** method. For all other hooks, the order is being reversed, meaning: if a middleware is registered first, it gets run last.
|
||||
@@ -73,9 +73,9 @@ You can now execute the test by running this in your app directory::
|
||||
|
||||
.. note:: PHPUnit executes all PHP Files that end with **Test.php**. Be sure to consider that in your file naming.
|
||||
|
||||
The apptemplateadvanced provides an own classloader :file:`tests/classloader.php` that loads the the classes.
|
||||
The Advanced Apptemplate provides an extra classloader :file:`tests/classloader.php` that loads the the classes. Require this file at the top of your tests.
|
||||
|
||||
.. note:: The classloader in the **tests/** directory assumes that the **appframework/** folder is in the same directory as the yourapp. If you run your app in a different apps folder, you will need to link the App Framework into the same folder where your app folder resides.
|
||||
.. note:: The classloader in the **tests/** directory assumes that the **appframework/** folder is in the same directory as the your app. If you run your app in a different apps folder, you will need to link the App Framework into the same folder where your app folder resides.
|
||||
|
||||
|
||||
More examples for testing controllers are in the :file:`tests/controller/ItemControllerTest.php`
|
||||
|
||||
@@ -100,7 +100,6 @@ ownCloud Interfaces
|
||||
-------------------
|
||||
ownCloud APIs that are ready to be built into the app
|
||||
|
||||
* :doc:`app/access`
|
||||
* :doc:`app/externalapi`
|
||||
* :doc:`app/filesystem`
|
||||
* :doc:`app/hooks`
|
||||
|
||||
Reference in New Issue
Block a user