aqhome-cgi: add functions for loading users and modules.
This commit is contained in:
@@ -603,4 +603,79 @@ uint32_t AQH_ModService_ReadPermsFromForm(GWEN_DB_NODE *dbPost, const AQH_PERMDE
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
AQH_MODULE_LIST *AQH_ModService_LoadRawModules(AQH_MODULE *m)
|
||||||
|
{
|
||||||
|
AQH_SERVICE *sv;
|
||||||
|
GWEN_STRINGLIST *slModuleNames;
|
||||||
|
|
||||||
|
sv=AQH_ModService_GetService(m);
|
||||||
|
slModuleNames=AQH_Service_ListModules(sv);
|
||||||
|
if (slModuleNames) {
|
||||||
|
AQH_MODULE_LIST *modList;
|
||||||
|
GWEN_STRINGLISTENTRY *se;
|
||||||
|
|
||||||
|
modList=AQH_Module_List_new();
|
||||||
|
se=GWEN_StringList_FirstEntry(slModuleNames);
|
||||||
|
while(se) {
|
||||||
|
const char *sModName;
|
||||||
|
|
||||||
|
sModName=GWEN_StringListEntry_Data(se);
|
||||||
|
if (sModName && *sModName) {
|
||||||
|
AQH_MODULE *currentMod;
|
||||||
|
|
||||||
|
currentMod=AQH_Service_LoadModule(sv, sModName);
|
||||||
|
if (currentMod)
|
||||||
|
AQH_Module_List_Add(currentMod, modList);
|
||||||
|
}
|
||||||
|
se=GWEN_StringListEntry_Next(se);
|
||||||
|
}
|
||||||
|
GWEN_StringList_free(slModuleNames);
|
||||||
|
if (AQH_Module_List_GetCount(modList))
|
||||||
|
return modList;
|
||||||
|
AQH_Module_List_free(modList);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
AQH_USER_LIST *AQH_ModService_LoadRawUsers(AQH_MODULE *m)
|
||||||
|
{
|
||||||
|
AQH_SERVICE *sv;
|
||||||
|
GWEN_STRINGLIST *slUserNames;
|
||||||
|
|
||||||
|
sv=AQH_ModService_GetService(m);
|
||||||
|
slUserNames=AQH_Service_ListUsers(sv);
|
||||||
|
if (slUserNames) {
|
||||||
|
AQH_USER_LIST *userList;
|
||||||
|
GWEN_STRINGLISTENTRY *se;
|
||||||
|
|
||||||
|
userList=AQH_User_List_new();
|
||||||
|
se=GWEN_StringList_FirstEntry(slUserNames);
|
||||||
|
while(se) {
|
||||||
|
const char *sModName;
|
||||||
|
|
||||||
|
sModName=GWEN_StringListEntry_Data(se);
|
||||||
|
if (sModName && *sModName) {
|
||||||
|
AQH_USER *u;
|
||||||
|
|
||||||
|
u=AQH_Service_LoadUser(sv, sModName);
|
||||||
|
if (u)
|
||||||
|
AQH_User_List_Add(u, userList);
|
||||||
|
}
|
||||||
|
se=GWEN_StringListEntry_Next(se);
|
||||||
|
}
|
||||||
|
GWEN_StringList_free(slUserNames);
|
||||||
|
if (AQH_User_List_GetCount(userList))
|
||||||
|
return userList;
|
||||||
|
AQH_User_List_free(userList);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ void AQH_ModService_AddRole(AQH_ROLE_LIST *roleList, int id, const char *name, u
|
|||||||
void AQH_ModService_WritePermsToForm(uint32_t perms, const AQH_PERMDEF_LIST *permDefList, const char *sPrefix, GWEN_BUFFER *dbuf);
|
void AQH_ModService_WritePermsToForm(uint32_t perms, const AQH_PERMDEF_LIST *permDefList, const char *sPrefix, GWEN_BUFFER *dbuf);
|
||||||
uint32_t AQH_ModService_ReadPermsFromForm(GWEN_DB_NODE *dbPost, const AQH_PERMDEF_LIST *permDefList, const char *sPrefix);
|
uint32_t AQH_ModService_ReadPermsFromForm(GWEN_DB_NODE *dbPost, const AQH_PERMDEF_LIST *permDefList, const char *sPrefix);
|
||||||
|
|
||||||
|
AQH_MODULE_LIST *AQH_ModService_LoadRawModules(AQH_MODULE *m);
|
||||||
|
AQH_USER_LIST *AQH_ModService_LoadRawUsers(AQH_MODULE *m);
|
||||||
|
|
||||||
|
|
||||||
void AQH_ModService_SetHandleRequestFn(AQH_MODULE *m, AQH_MODSERVICE_HANDLEREQUEST_FN fn);
|
void AQH_ModService_SetHandleRequestFn(AQH_MODULE *m, AQH_MODSERVICE_HANDLEREQUEST_FN fn);
|
||||||
|
|||||||
Reference in New Issue
Block a user