Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
lang
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
Administrator
lang
Commits
7c056904
Commit
7c056904
authored
Apr 24, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dynamic: read custom ACL files; closes #2
parent
5fadb694
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
acl.py
dynamic/plugins/acl.py
+23
-0
No files found.
dynamic/plugins/acl.py
View file @
7c056904
...
...
@@ -30,6 +30,14 @@
"""
__author__
=
'Ad Schellevis'
def
recursiveParseForm
(
xmlNode
):
for
childNode
in
xmlNode
:
for
tag
in
recursiveParseForm
(
childNode
):
yield
tag
if
xmlNode
.
tag
==
'description'
:
yield
xmlNode
.
text
def
getTranslations
(
root
):
import
json
...
...
@@ -43,3 +51,18 @@ def getTranslations(root):
for
aclKey
in
aclMap
.
keys
():
if
aclMap
[
aclKey
]
.
has_key
(
'descr'
):
yield
aclMap
[
aclKey
][
'descr'
]
import
os
import
xml.etree.ElementTree
as
ET
rootpath
=
'
%
s/opnsense/mvc/app/models/'
%
root
for
rootdir
,
dirs
,
files
in
os
.
walk
(
rootpath
,
topdown
=
False
):
for
name
in
files
:
if
name
.
lower
()[
-
4
:]
==
'.xml'
:
filename
=
'
%
s/
%
s'
%
(
rootdir
,
name
)
tree
=
ET
.
parse
(
filename
)
rootObj
=
tree
.
getroot
()
if
rootObj
.
tag
==
'acl'
:
for
tag
in
recursiveParseForm
(
rootObj
):
yield
tag
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