2424#include " cull/cull_list.h"
2525
2626#include " sgeobj/sge_answer.h"
27+ #include " sgeobj/sge_userset.h"
2728#include " sgeobj/sge_utility.h"
29+ #include " sgeobj/cull/sge_str_ST_L.h"
2830#include " sgeobj/ocs_Role.h"
2931
3032#include " msg_common.h"
@@ -36,7 +38,7 @@ ocs::Role::locate(const lList *role_list, const char *name) {
3638}
3739
3840bool
39- ocs::Role::validate (lListElem *role, lList **answer_list, bool startup) {
41+ ocs::Role::validate (const lListElem *role, lList **answer_list, bool startup) {
4042 DENTER (TOP_LAYER);
4143
4244 if (const char *name = lGetString (role, RL_name);
@@ -47,6 +49,35 @@ ocs::Role::validate(lListElem *role, lList **answer_list, bool startup) {
4749 DRETURN (true );
4850}
4951
52+ void
53+ ocs::Role::check_integrity (const lList *role_list, const lList *userset_list, lList **answer_list) {
54+ DENTER (TOP_LAYER);
55+
56+ for_each_ep_lv (role, role_list) {
57+ const char *role_name = lGetString (role, RL_name);
58+
59+ // check each user_list entry against the master userset list
60+ for_each_ep_lv (user_ep, lGetList (role, RL_user_list)) {
61+ const char *userset_name = lGetString (user_ep, US_name);
62+ if (!lGetElemStr (userset_list, US_name, userset_name)) {
63+ WARNING (MSG_ROLE_INTEGRITY_USERSET_SS, role_name, userset_name);
64+ answer_list_add (answer_list, SGE_EVENT, STATUS_EUNKNOWN, ANSWER_QUALITY_WARNING);
65+ }
66+ }
67+
68+ // check each parent_role_list entry against the master role list
69+ for_each_ep_lv (parent_ep, lGetList (role, RL_parent_role_list)) {
70+ const char *parent_name = lGetString (parent_ep, ST_name);
71+ if (!lGetElemStr (role_list, RL_name, parent_name)) {
72+ WARNING (MSG_ROLE_INTEGRITY_PARENT_SS, role_name, parent_name);
73+ answer_list_add (answer_list, SGE_EVENT, STATUS_EUNKNOWN, ANSWER_QUALITY_WARNING);
74+ }
75+ }
76+ }
77+
78+ DRETURN_VOID;
79+ }
80+
5081lListElem *
5182ocs::Role::create_template () {
5283 DENTER (TOP_LAYER);
0 commit comments