Skip to content

Commit 84c3988

Browse files
committed
Refactor: libcrmcommon: Drop xml_acl_enabled() internally
Signed-off-by: Reid Wahl <[email protected]>
1 parent a39a074 commit 84c3988

File tree

3 files changed

+14
-70
lines changed

3 files changed

+14
-70
lines changed

lib/common/acl.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,16 +216,20 @@ void
216216
pcmk__apply_acl(xmlNode *xml)
217217
{
218218
GList *aIter = NULL;
219-
xml_doc_private_t *docpriv = xml->doc->_private;
220-
xml_node_private_t *nodepriv;
219+
xml_doc_private_t *docpriv = NULL;
220+
xml_node_private_t *nodepriv = NULL;
221221
xmlXPathObject *xpathObj = NULL;
222222

223-
if (!xml_acl_enabled(xml)) {
223+
pcmk__assert(xml != NULL);
224+
225+
if (!pcmk__xml_doc_all_flags_set(xml->doc, pcmk__xf_acl_enabled)) {
224226
crm_trace("Skipping ACLs for user '%s' because not enabled for this XML",
225227
docpriv->acl_user);
226228
return;
227229
}
228230

231+
docpriv = xml->doc->_private;
232+
229233
for (aIter = docpriv->acls; aIter != NULL; aIter = aIter->next) {
230234
int max = 0, lpc = 0;
231235
xml_acl_t *acl = aIter->data;
@@ -681,7 +685,9 @@ xml_acl_denied(const xmlNode *xml)
681685
void
682686
xml_acl_disable(xmlNode *xml)
683687
{
684-
if (xml_acl_enabled(xml)) {
688+
if ((xml != NULL)
689+
&& pcmk__xml_doc_all_flags_set(xml->doc, pcmk__xf_acl_enabled)) {
690+
685691
xml_doc_private_t *docpriv = xml->doc->_private;
686692

687693
/* Catch anything that was created but shouldn't have been */
@@ -749,8 +755,8 @@ pcmk__check_acl(xmlNode *xml, const char *attr_name, enum pcmk__xml_flags mode)
749755

750756
pcmk__assert((xml != NULL) && (xml->doc->_private != NULL));
751757

752-
if (!pcmk__xml_doc_all_flags_set(xml->doc, pcmk__xf_tracking)
753-
|| !xml_acl_enabled(xml)) {
758+
if (!pcmk__xml_doc_all_flags_set(xml->doc,
759+
pcmk__xf_tracking|pcmk__xf_acl_enabled)) {
754760
return true;
755761
}
756762

lib/common/tests/acl/Makefile.am

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2021-2024 the Pacemaker project contributors
2+
# Copyright 2021-2025 the Pacemaker project contributors
33
#
44
# The version control history for this file may have further details.
55
#
@@ -15,7 +15,6 @@ include $(top_srcdir)/mk/unittest.mk
1515

1616
check_PROGRAMS = pcmk__is_user_in_group_test \
1717
pcmk_acl_required_test \
18-
xml_acl_denied_test \
19-
xml_acl_enabled_test
18+
xml_acl_denied_test
2019

2120
TESTS = $(check_PROGRAMS)

lib/common/tests/acl/xml_acl_enabled_test.c

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)