Skip to content

Commit d02cd23

Browse files
committed
API: libcrmcommon: Deprecate xml_acl_enabled()
Signed-off-by: Reid Wahl <[email protected]>
1 parent 84c3988 commit d02cd23

File tree

4 files changed

+63
-21
lines changed

4 files changed

+63
-21
lines changed

include/crm/common/Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2004-2024 the Pacemaker project contributors
2+
# Copyright 2004-2025 the Pacemaker project contributors
33
#
44
# The version control history for this file may have further details.
55
#
@@ -12,6 +12,7 @@ include $(top_srcdir)/mk/common.mk
1212
headerdir=$(pkgincludedir)/crm/common
1313

1414
header_HEADERS = acl.h \
15+
acl_compat.h \
1516
actions.h \
1617
agents.h \
1718
cib.h \

include/crm/common/acl.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2004-2024 the Pacemaker project contributors
2+
* Copyright 2004-2025 the Pacemaker project contributors
33
*
44
* The version control history for this file may have further details.
55
*
@@ -23,14 +23,17 @@ extern "C" {
2323
* \ingroup core
2424
*/
2525

26-
bool xml_acl_enabled(const xmlNode *xml);
2726
void xml_acl_disable(xmlNode *xml);
2827
bool xml_acl_denied(const xmlNode *xml);
2928
bool xml_acl_filtered_copy(const char *user, xmlNode* acl_source, xmlNode *xml,
3029
xmlNode **result);
3130

3231
bool pcmk_acl_required(const char *user);
3332

33+
#if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
34+
#include <crm/common/acl_compat.h>
35+
#endif // !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
36+
3437
#ifdef __cplusplus
3538
}
3639
#endif

include/crm/common/acl_compat.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright 2004-2025 the Pacemaker project contributors
3+
*
4+
* The version control history for this file may have further details.
5+
*
6+
* This source code is licensed under the GNU Lesser General Public License
7+
* version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
8+
*/
9+
10+
#ifndef PCMK__CRM_COMMON_ACL_COMPAT__H
11+
#define PCMK__CRM_COMMON_ACL_COMPAT__H
12+
13+
#include <stdbool.h>
14+
15+
#include <libxml/tree.h> // xmlNode
16+
17+
#ifdef __cplusplus
18+
extern "C" {
19+
#endif
20+
21+
/**
22+
* \file
23+
* \brief Deprecated Pacemaker ACL API
24+
* \ingroup core
25+
* \deprecated Do not include this header directly. The XML APIs in this
26+
* header, and the header itself, will be removed in a future
27+
* release.
28+
*/
29+
30+
//! \deprecated Do not use
31+
bool xml_acl_enabled(const xmlNode *xml);
32+
33+
#ifdef __cplusplus
34+
}
35+
#endif
36+
37+
#endif // PCMK__CRM_COMMON_ACL_COMPAT__H

lib/common/acl.c

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -697,24 +697,6 @@ xml_acl_disable(xmlNode *xml)
697697
}
698698
}
699699

700-
/*!
701-
* \brief Check whether or not an XML node is ACL-enabled
702-
*
703-
* \param[in] xml node to check
704-
*
705-
* \return true if XML node exists and is ACL-enabled, false otherwise
706-
*/
707-
bool
708-
xml_acl_enabled(const xmlNode *xml)
709-
{
710-
if (xml && xml->doc && xml->doc->_private){
711-
xml_doc_private_t *docpriv = xml->doc->_private;
712-
713-
return pcmk_is_set(docpriv->flags, pcmk__xf_acl_enabled);
714-
}
715-
return false;
716-
}
717-
718700
/*!
719701
* \internal
720702
* \brief Deny access to an XML tree's document based on ACLs
@@ -924,3 +906,22 @@ pcmk__update_acl_user(xmlNode *request, const char *field,
924906

925907
return requested_user;
926908
}
909+
910+
// Deprecated functions kept only for backward API compatibility
911+
// LCOV_EXCL_START
912+
913+
#include <crm/common/xml_compat.h>
914+
915+
bool
916+
xml_acl_enabled(const xmlNode *xml)
917+
{
918+
if (xml && xml->doc && xml->doc->_private){
919+
xml_doc_private_t *docpriv = xml->doc->_private;
920+
921+
return pcmk_is_set(docpriv->flags, pcmk__xf_acl_enabled);
922+
}
923+
return false;
924+
}
925+
926+
// LCOV_EXCL_STOP
927+
// End deprecated API

0 commit comments

Comments
 (0)