mirror of
https://github.com/SELinuxProject/setools
synced 2025-03-25 04:26:28 +00:00
Rename type attribute interfaces.
Make sure they reflect that they are for type rather than role attributes.
This commit is contained in:
parent
606bda30a9
commit
f4b1b68195
2
seinfo
2
seinfo
@ -225,7 +225,7 @@ try:
|
||||
print(" Sensitivities: {0:7} Categories: {1:7}".format(
|
||||
p.level_count, p.category_count))
|
||||
print(" Types: {0:7} Attributes: {1:7}".format(
|
||||
p.type_count, p.attribute_count))
|
||||
p.type_count, p.type_attribute_count))
|
||||
print(" Users: {0:7} Roles: {1:7}".format(
|
||||
p.user_count, p.role_count))
|
||||
print(" Booleans: {0:7} Cond. Expr.: {1:7}".format(
|
||||
|
@ -104,11 +104,6 @@ class SELinuxPolicy(object):
|
||||
"""The number of (type) allow rules."""
|
||||
return self.policy.avrule_allow_count()
|
||||
|
||||
@property
|
||||
def attribute_count(self):
|
||||
"""The number of (type) attributes."""
|
||||
return sum(1 for _ in self.attributes())
|
||||
|
||||
@property
|
||||
def auditallow_count(self):
|
||||
"""The number of auditallow rules."""
|
||||
@ -234,6 +229,11 @@ class SELinuxPolicy(object):
|
||||
"""The number of role_transition rules."""
|
||||
return self.policy.role_trans_count()
|
||||
|
||||
@property
|
||||
def type_attribute_count(self):
|
||||
"""The number of (type) attributes."""
|
||||
return sum(1 for _ in self.typeattributes())
|
||||
|
||||
@property
|
||||
def type_count(self):
|
||||
"""The number of types."""
|
||||
@ -315,16 +315,6 @@ class SELinuxPolicy(object):
|
||||
# Policy components generators
|
||||
#
|
||||
|
||||
def attributes(self):
|
||||
"""Generator which yields all (type) attributes."""
|
||||
|
||||
for type_ in self.policy.type_iter():
|
||||
try:
|
||||
yield typeattr.attribute_factory(self.policy, type_)
|
||||
except TypeError:
|
||||
# libqpol unfortunately iterates over attributes and aliases
|
||||
pass
|
||||
|
||||
def bools(self):
|
||||
"""Generator which yields all Booleans."""
|
||||
|
||||
@ -409,6 +399,16 @@ class SELinuxPolicy(object):
|
||||
# libqpol unfortunately iterates over attributes and aliases
|
||||
pass
|
||||
|
||||
def typeattributes(self):
|
||||
"""Generator which yields all (type) attributes."""
|
||||
|
||||
for type_ in self.policy.type_iter():
|
||||
try:
|
||||
yield typeattr.attribute_factory(self.policy, type_)
|
||||
except TypeError:
|
||||
# libqpol unfortunately iterates over attributes and aliases
|
||||
pass
|
||||
|
||||
def users(self):
|
||||
"""Generator which yields all users."""
|
||||
|
||||
|
@ -191,7 +191,7 @@ class SELinuxPolicyTest(unittest.TestCase):
|
||||
|
||||
def test_130_type_attribute_count(self):
|
||||
"""SELinuxPolicy: type attribute count"""
|
||||
self.assertEqual(self.p.attribute_count, 157)
|
||||
self.assertEqual(self.p.type_attribute_count, 157)
|
||||
|
||||
def test_131_type_change_count(self):
|
||||
"""SELinuxPolicy: type_change rule count"""
|
||||
|
Loading…
Reference in New Issue
Block a user