From 38f66bfd10af6912cc10851be1ab69f435ad957a Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Wed, 19 Dec 2012 11:39:20 +0100 Subject: [PATCH] Autoz::is_allowed when exclude_null accepts resource NULL. --- src/autoz.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/autoz.c b/src/autoz.c index 14befbf..406a716 100644 --- a/src/autoz.c +++ b/src/autoz.c @@ -1095,7 +1095,6 @@ autoz_is_allowed (Autoz *autoz, AutozIRole *irole, AutozIResource *iresource, gb g_return_val_if_fail (IS_AUTOZ (autoz), FALSE); g_return_val_if_fail (AUTOZ_IS_IROLE (irole), FALSE); - g_return_val_if_fail (AUTOZ_IS_IRESOURCE (iresource), FALSE); _autoz_check_updated (autoz); @@ -1110,13 +1109,6 @@ autoz_is_allowed (Autoz *autoz, AutozIRole *irole, AutozIResource *iresource, gb return ret; } - resource = _autoz_get_resource_from_id (autoz, _autoz_remove_resource_name_prefix_from_id (autoz, autoz_iresource_get_resource_id (iresource))); - if (resource == NULL) - { - g_warning ("Resource «%s» not found.", autoz_iresource_get_resource_id (iresource)); - return ret; - } - if (!exclude_null) { /* first trying for a rule for every resource */ @@ -1136,6 +1128,15 @@ autoz_is_allowed (Autoz *autoz, AutozIRole *irole, AutozIResource *iresource, gb } } + g_return_val_if_fail (AUTOZ_IS_IRESOURCE (iresource), FALSE); + + resource = _autoz_get_resource_from_id (autoz, _autoz_remove_resource_name_prefix_from_id (autoz, autoz_iresource_get_resource_id (iresource))); + if (resource == NULL) + { + g_warning ("Resource «%s» not found.", autoz_iresource_get_resource_id (iresource)); + return ret; + } + /* and after for specific resource */ str_id = g_strconcat (autoz_irole_get_role_id (irole), "|", -- 2.49.0