User Tools

Site Tools


docs:guide-developer:ubus:session

ubus session

Path Procedure Signature Description
session create { “timeout”: timeout } Create a new session and return its ID, set the session timeout to timeout
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”, “objects”: [ [ “path”, “func” ], … ] } Within the session identified by sid grant access to all specified procedures func in the namespace path listed in the objects array
session revoke { “ubus_rpc_session”: “sid”, “scope”: “scope”, “objects”: [ [ “path”, “func” ], … ] } Within the session identified by sid revoke access to all specified procedures func in the namespace path listed in the objects array. If objects is unset, revoke all access
session access { “ubus_rpc_session”: “sid”, “scope”: “scope”, “object”: “path”, “function”: “function” } Query whether access to the specified function in the namespace path is allowed
session set { “ubus_rpc_session”: “sid”, “values”: { “key”: value, … } } Within the session identified by sid store the given arbitrary values under their corresponding keys specified in the values object
session get { “ubus_rpc_session”: “sid”, “keys”: [ “key”, … ] } Within the session identified by sid retrieve all values associated with the given keys listed in the keys array. If the key array is unset, dump all key/value pairs
session unset { “ubus_rpc_session”: “sid”, “keys”: [ “key”, … ] } Within the session identified by sid unset all keys listed in the keys array. If the key list is unset, clear all keys
session destroy { “ubus_rpc_session”: “sid” } Terminate the session identified by the given ID sid
session login { “username”: “username”, “password”: “password”, “timeout”: timeout } Authenticate with rpcd and create a new session with access rights as specified in the ACLs

Note: When using ubus over HTTP, setting ubus_rpc_session isn't allowed, it's automatically set to the calling session.

login call description

Use session.login to authorize and create a new session. The timeout argument is optional, it is set in seconds and by default is 5 minutes (300 seconds). The session timeout is automatically reset on every use.

Return example:

{
        "ubus_rpc_session": "948abf19b632c5460384315d69010e09",
        "timeout": 300,
        "expires": 299,
        "acls": {
                "access-group": {
                        "uci-access": [
                                "read",
                                "write"
                        ],
                        "unauthenticated": [
                                "read"
                        ]
                },
                "ubus": {
                        "file": [
                                "*"
                        ],
                        "session": [
                                "access",
                                "login"
                        ]
                },
                "uci": {
                        "*": [
                                "read",
                                "write"
                        ]
                }
        },
        "data": {
                "username": "root"
        }
}

To list all active sessions call session list.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
docs/guide-developer/ubus/session.txt · Last modified: 2020/01/11 13:06 by stokito