Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docs:guide-developer:ubus:session [2020/02/02 13:24] – [login call description] stokitodocs:guide-developer:ubus:session [2020/02/02 15:13] (current) – [Example of manual session creation] stokito
Line 2: Line 2:
  
 ^ Path ^ Procedure ^ Signature ^ Description ^ ^ Path ^ Procedure ^ Signature ^ Description ^
-| ''session'' | ''create'' | ''{ "timeout": //timeout// }'' | Create a new session and return its ID, set the session timeout to ''//timeout//'' in seconds |+| ''session'' | ''create'' | ''{ "timeout": //timeout// }'' | Create a new session and return its ID, set the session timeout to ''//timeout//'' in seconds (set ''0'' for no expire)  |
 | ''session'' | ''list'' | ''{ "ubus_rpc_session": "//sid//" }'' | Dump session info specified by ''//sid//'', if no ID is given, list all sessions | | ''session'' | ''list'' | ''{ "ubus_rpc_session": "//sid//" }'' | Dump session info specified by ''//sid//'', if no ID is given, list all sessions |
 | ''session'' | ''grant'' | ''{ "ubus_rpc_session": "//sid//", "scope": "//scope//", | ''session'' | ''grant'' | ''{ "ubus_rpc_session": "//sid//", "scope": "//scope//",
Line 23: Line 23:
  
 **Note:** When using ubus over HTTP, setting ''ubus_rpc_session'' isn't allowed, it's automatically set to the calling session. **Note:** When using ubus over HTTP, setting ''ubus_rpc_session'' isn't allowed, it's automatically set to the calling session.
 +
 +**Note:** Sessions are stored in memory so they will persist as long as ''rpcd'' is running
 +
  
 ==== login call description ==== ==== login call description ====
Line 94: Line 97:
         "expires": 3600,         "expires": 3600,
         "acls": {         "acls": {
-                "write": {+                "ubus": {
                         "file": [                         "file": [
                                 "*"                                 "*"
Line 107: Line 110:
         }         }
 } }
-root@openwrt:~# ubus call session access '{ "ubus_rpc_session": "bf11e5cd01cd262ae692600a6a45ccfc", "scope": "write", "object": "system", "function": "reboot" }'+root@OpenWrt:~# ubus call session access '{ "ubus_rpc_session": "bf11e5cd01cd262ae692600a6a45ccfc", "scope": "ubus", "object": "system", "function": "reboot" }'
 { {
         "access": false         "access": false
  • Last modified: 2020/02/02 13:24
  • by stokito