diff options
author | Badlop <badlop@process-one.net> | 2008-02-12 01:04:47 +0000 |
---|---|---|
committer | Badlop <badlop@process-one.net> | 2008-02-12 01:04:47 +0000 |
commit | 60e1972f614e059778431c19b90077560dd73327 (patch) | |
tree | dcfc0b956f47cb9b20452efbfd19058b02258587 /src | |
parent | use if event instead of x when xmlns is pubsub#event (EJAB-518) (diff) |
* src/acl.erl: Normalize ACL before adding to the configuration
tables (EJAB-521)
SVN Revision: 1185
Diffstat (limited to 'src')
-rw-r--r-- | src/acl.erl | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/acl.erl b/src/acl.erl index ee26a5e42..c3fcebba4 100644 --- a/src/acl.erl +++ b/src/acl.erl @@ -48,12 +48,12 @@ start() -> ok. to_record(Host, ACLName, ACLSpec) -> - #acl{aclname = {ACLName, Host}, aclspec = ACLSpec}. + #acl{aclname = {ACLName, Host}, aclspec = normalize_spec(ACLSpec)}. add(Host, ACLName, ACLSpec) -> F = fun() -> mnesia:write(#acl{aclname = {ACLName, Host}, - aclspec = ACLSpec}) + aclspec = normalize_spec(ACLSpec)}) end, mnesia:transaction(F). @@ -75,7 +75,7 @@ add_list(Host, ACLs, Clear) -> aclspec = ACLSpec} -> mnesia:write( #acl{aclname = {ACLName, Host}, - aclspec = ACLSpec}) + aclspec = normalize_spec(ACLSpec)}) end end, ACLs) end, @@ -86,6 +86,17 @@ add_list(Host, ACLs, Clear) -> false end. +normalize(A) -> + jlib:nodeprep(A). +normalize_spec({A, B}) -> + {A, normalize(B)}; +normalize_spec({A, B, C}) -> + {A, normalize(B), normalize(C)}; +normalize_spec(all) -> + all; +normalize_spec(none) -> + none. + match_rule(global, Rule, JID) -> |