polyfemos.front.trafficmonitor¶
Monitors and limits website usage
- copyright
2019, University of Oulu, Sodankyla Geophysical Observatory
- license
GNU Lesser General Public License v3.0 or later (https://spdx.org/licenses/LGPL-3.0-or-later.html)
Public Functions
-
polyfemos.front.trafficmonitor.
check_permission
(access_level, limit_network=False)[source]¶ The users and their access levels are defined in YAML config files. See
users()
for more info.The local user (ip=’127.0.0.1’) has the maximum access level (1). An unidentified user will have the minimum access level (the function always returns
False
).- Parameters
- Return type
- Returns
Returns
True
if the users access level is smaller or equal to requested access level (access_level
).
-
polyfemos.front.trafficmonitor.
limit_access
(access_level=2, limit_network=True)[source]¶ A decorator used limit access of users. Users with access level equal or greater than 3 are not permitted to enter the site.
The access level check made by calling
check_permission()
.
-
polyfemos.front.trafficmonitor.
limited
(ipstorage)[source]¶ A function call limiter. The functions with limited decorator may only be called one at the time per IP address. Use as a decorator with arguments. This applies to users with access level equal or more than 2.
The access level check made by calling
check_permission()
.
-
polyfemos.front.trafficmonitor.
logged
(func_)[source]¶ A decorator used to log usage of the functions Logs the time, IP address and username of the user and the function (
func_
) used.- Parameters
func_ (func) –
- Return type
func
- Returns
Classes
A class which handles IP addresses of the users |