Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
4a52f394
Commit
4a52f394
authored
Oct 13, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(captiveportal, new) add address_active to db class
parent
8c05a136
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
db.py
src/opnsense/scripts/OPNsense/CaptivePortal/lib/db.py
+17
-0
No files found.
src/opnsense/scripts/OPNsense/CaptivePortal/lib/db.py
View file @
4a52f394
...
...
@@ -63,6 +63,23 @@ class DB(object):
cur
.
executescript
(
open
(
init_script_filename
,
'rb'
)
.
read
())
cur
.
close
()
def
address_active
(
self
,
zoneid
,
ip_address
):
""" check if address / network is active
:param zoneid: cp zone number
:param ip_address: ip address (to unlock)
:return: active status (boolean)
"""
cur
=
self
.
_connection
.
cursor
()
request
=
{
'zoneid'
:
zoneid
,
'ip_address'
:
ip_address
}
cur
.
execute
(
"""select count(*)
from cp_clients
where deleted = 0 and zoneid = :zoneid and ip_address = :ip_address"""
,
request
)
if
cur
.
fetchall
()[
0
][
0
]
>
0
:
return
True
else
:
return
False
def
add_client
(
self
,
zoneid
,
authenticated_via
,
username
,
ip_address
,
mac_address
):
""" add a new client to the captive portal administration
:param zoneid: cp zone number
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment