diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/roles.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/util/roles.lua b/util/roles.lua index a38faa58..2c3a5026 100644 --- a/util/roles.lua +++ b/util/roles.lua @@ -86,6 +86,16 @@ function role_methods:set_permission(permission_name, policy, overwrite) return true; end +function role_methods:policies() + local policy_iterator, s, v = it.join(pairs(self[permissions_key])); + if self.inherits then + for _, inherited_role in ipairs(self.inherits) do + policy_iterator:append(inherited_role:policies()); + end + end + return policy_iterator, s, v; +end + function role_mt.__tostring(self) return ("role<[%s] %s>"):format(self.id or "nil", self.name or "[no name]"); end |