diff --git a/apps/aqhome-cgi/modules/common/mservice.c b/apps/aqhome-cgi/modules/common/mservice.c
index e29fb73..360f86d 100644
--- a/apps/aqhome-cgi/modules/common/mservice.c
+++ b/apps/aqhome-cgi/modules/common/mservice.c
@@ -28,6 +28,10 @@
#define AQH_MOD_SERVICE_FOOTERFILE "footer.html"
+#define GBAS GWEN_Buffer_AppendString
+#define GBAA GWEN_Buffer_AppendArgs
+
+
/* ------------------------------------------------------------------------------------------------
* global vars
@@ -522,4 +526,81 @@ void AQH_ModService_HandleRequestWithTable(AQH_MODULE *m,
+void AQH_ModService_WritePermsToForm(uint32_t perms, const AQH_PERMDEF_LIST *permDefList, const char *sPrefix, GWEN_BUFFER *dbuf)
+{
+ if (permDefList) {
+ const AQH_PERMDEF *permDef;
+ GWEN_BUFFER *tbuf;
+ uint32_t pos;
+
+ tbuf=GWEN_Buffer_new(0, 256, 0, 1);
+ if (sPrefix && *sPrefix)
+ GBAA(tbuf, "%s:", sPrefix);
+ pos=GWEN_Buffer_GetPos(tbuf);
+
+ permDef=AQH_PermDef_List_First(permDefList);
+ while(permDef) {
+ const char *s;
+
+ s=AQH_PermDef_GetId(permDef);
+ if (s && *s) {
+ uint32_t mask;
+
+ GBAS(tbuf, s);
+ mask=AQH_PermDef_GetMask(permDef);
+ if (perms & mask)
+ GBAA(dbuf, "", GWEN_Buffer_GetStart(tbuf));
+ else
+ GBAA(dbuf, "", s?s:"");
+ GBAA(dbuf, "", GWEN_Buffer_GetStart(tbuf), s?s:"");
+ GWEN_Buffer_Crop(tbuf, 0, pos);
+ }
+ permDef=AQH_PermDef_List_Next(permDef);
+ }
+ GWEN_Buffer_free(tbuf);
+ }
+}
+
+
+
+uint32_t AQH_ModService_ReadPermsFromForm(GWEN_DB_NODE *dbPost, const AQH_PERMDEF_LIST *permDefList, const char *sPrefix)
+{
+ uint32_t result=0;
+
+ if (permDefList) {
+ const AQH_PERMDEF *permDef;
+ GWEN_BUFFER *tbuf;
+ uint32_t pos;
+
+ tbuf=GWEN_Buffer_new(0, 256, 0, 1);
+ if (sPrefix && *sPrefix)
+ GBAA(tbuf, "%s:", sPrefix);
+ pos=GWEN_Buffer_GetPos(tbuf);
+
+ permDef=AQH_PermDef_List_First(permDefList);
+ while(permDef) {
+ const char *id;
+
+ id=AQH_PermDef_GetId(permDef);
+ if (id && *id) {
+ uint32_t mask;
+ const char *s;
+
+ GBAS(tbuf, id);
+ mask=AQH_PermDef_GetMask(permDef);
+ s=GWEN_DB_GetCharValue(dbPost, GWEN_Buffer_GetStart(tbuf), 0, NULL);
+ if (s && *s)
+ result|=mask;
+ GWEN_Buffer_Crop(tbuf, 0, pos);
+ }
+ permDef=AQH_PermDef_List_Next(permDef);
+ }
+ GWEN_Buffer_free(tbuf);
+ }
+
+ return result;
+}
+
+
+
diff --git a/apps/aqhome-cgi/modules/common/mservice.h b/apps/aqhome-cgi/modules/common/mservice.h
index 627b70a..5666e1e 100644
--- a/apps/aqhome-cgi/modules/common/mservice.h
+++ b/apps/aqhome-cgi/modules/common/mservice.h
@@ -63,6 +63,10 @@ void AQH_ModService_AddPermDef(AQH_PERMDEF_LIST *permDefList, const char *id, ui
void AQH_ModService_AddRole(AQH_ROLE_LIST *roleList, int id, const char *name, uint32_t perms, const char *descr);
+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);
+
+
void AQH_ModService_SetHandleRequestFn(AQH_MODULE *m, AQH_MODSERVICE_HANDLEREQUEST_FN fn);
void AQH_ModService_SetLoadSubModuleFn(AQH_MODULE *m, AQH_MODSERVICE_LOADSUBMODULE_FN fn);
diff --git a/apps/aqhome-cgi/service/moduleperms.t2d b/apps/aqhome-cgi/service/moduleperms.t2d
index 913f8b6..c8d8b76 100644
--- a/apps/aqhome-cgi/service/moduleperms.t2d
+++ b/apps/aqhome-cgi/service/moduleperms.t2d
@@ -59,14 +59,6 @@
-
-
- 0
- 0
- public
- volatile
-
-