/* FILE $Id$ PURPOSE Non-schema dependent tauthorize.c expansion. AUTHOR GPL License applies, see www.fsf.org for details See LICENSE file in this distribution (C) 2001-2009 Gary Wallis and Hugo Urquiza. */ void tAuthorizeNavList(void); void EncryptPasswd(char *cPasswd);//main.c const char *cUserLevel(unsigned uPermLevel);//tclientfunc.h void ExtProcesstAuthorizeVars(pentry entries[], int x) { /* register int i; for(i=0;i=12) { ProcesstAuthorizeVars(entries,x); //Check global conditions for new record here guMode=2000; tAuthorize(LANG_NB_CONFIRMNEW); } } else if(!strcmp(gcCommand,LANG_NB_CONFIRMNEW)) { if(guPermLevel>=12) { ProcesstAuthorizeVars(entries,x); //Check entries here uAuthorize=0; uCreatedBy=guLoginClient; uOwner=guLoginClient; uModBy=0;//Never modified NewtAuthorize(0); } } else if(!strcmp(gcCommand,LANG_NB_DELETE)) { ProcesstAuthorizeVars(entries,x); if(guPermLevel>=12) { guMode=2001; tAuthorize(LANG_NB_CONFIRMDEL); } } else if(!strcmp(gcCommand,LANG_NB_CONFIRMDEL)) { ProcesstAuthorizeVars(entries,x); if(guPermLevel>=12) { guMode=5; DeletetAuthorize(); } } else if(!strcmp(gcCommand,LANG_NB_MODIFY)) { ProcesstAuthorizeVars(entries,x); if(uAllowMod(uOwner,uCreatedBy)) { guMode=2002; tAuthorize(LANG_NB_CONFIRMMOD); } else tAuthorize("Error: Denied by permissions settings"); } else if(!strcmp(gcCommand,LANG_NB_CONFIRMMOD)) { ProcesstAuthorizeVars(entries,x); if(uAllowMod(uOwner,uCreatedBy)) { if(uPerm>guPermLevel) uPerm=guPermLevel; if(uPerm<6 || uPerm>12) { guMode=2002; sprintf(gcQuery,"uPerm level error:%u",uPerm); tAuthorize(gcQuery); } if(!cPasswd[0] && !cClrPasswd[0]) { guMode=2002; tAuthorize("Must provide a passwd"); } if(cClrPasswd[0]) { sprintf(cPasswd,"%.35s",cClrPasswd); EncryptPasswd(cPasswd); } else { if(strncmp(cPasswd,"..",2) && strncmp(cPasswd,"$1$",3)) EncryptPasswd(cPasswd); } uModBy=guLoginClient; ModtAuthorize(); } else tAuthorize("Error: Denied by permissions settings"); } } }//void ExttAuthorizeCommands(pentry entries[], int x) void ExttAuthorizeButtons(void) { OpenFieldSet("tAuthorize Aux Panel",100); switch(guMode) { case 2000: printf("New: Step 1 Tips
"); printf("This should only be done by experienced staff.

"); printf("cLabel: This field is the login char string.

"); printf("cIpMask: This field is optionally used to limit the login from IP or IP range.

"); printf("uPerm: This field is a number value of utmost importance. See the tClient [Authorize] process for more information.

"); printf("uCertClient: Is usually the tClient.uClient number of the usage owner of this record, but maybe an alias like the value 1 for the default Root user.

"); printf("Password setting: You can either enter a clear text passwd in cClrPasswd or enter a clear text passwd in cPasswd that will be encrypted into cPasswd and no cClrPasswd will be saved. And finally you can enter a fixed '..' salt DES encrypted passwd into cPasswd..

"); printf(LANG_NBB_CONFIRMNEW); printf("
\n"); break; case 2001: printf(LANG_NBB_CONFIRMDEL); printf("
\n"); break; case 2002: printf("Modify: Step 1 Tips
"); printf("Password changing: You have several choices for passwd changing: You can either enter a clear text passwd in cClrPasswd or enter a clear text passwd in cPasswd that will be encrypted into cPasswd and no cClrPasswd will be saved. And finally you can enter an MD5 $1$ prefixed encrypted password (or for backwards compatability a fixed '..' salt DES encrypted ) passwd into cPasswd.

\n"); printf("Other field changes: Unless you are absolutely sure what you need done, have 2nd level support (support@unixservice.com) do it for you.

\n"); printf(LANG_NBB_CONFIRMMOD); printf("
\n"); break; default: printf("Table Tips
"); printf("Here you can change a passwd for a login of a contact or a non company affiliated login user. Other more complex changes can be done on other fields, but you should seek guidance from experienced users first. Clicking on the modify (new or delete) button will provide more details. All changes are two step operations so there is no danger on clicking on the 'New', 'Modify' or 'Delete' buttons.

\n"); printf("Record Context Info
"); if(uCertClient>1 && uOwner>1) printf("This login appears to belong to a '%s' company contact '%s'.
The uPerm corresponds to permission level '%s'.",uOwner,ForeignKey("tClient","cLabel",uOwner),uCertClient,ForeignKey("tClient","cLabel",uCertClient),cUserLevel(uPerm)); else if(uOwner>1) printf("This login appears to belong to a '%s' company contact, but that has been root aliased to usually run the back-office with complete permissions.
The uPerm corresponds to permission level '%s'.",uOwner,ForeignKey("tClient","cLabel",uOwner),cUserLevel(uPerm)); printf("

\n"); tAuthorizeNavList(); } CloseFieldSet(); }//void ExttAuthorizeButtons(void) void ExttAuthorizeAuxTable(void) { }//void ExttAuthorizeAuxTable(void) void ExttAuthorizeGetHook(entry gentries[], int x) { register int i; for(i=0;iSelect "); printf(""); }//void ExttAuthorizeListFilter(void) void ExttAuthorizeNavBar(void) { printf(LANG_NBB_SKIPFIRST); printf(LANG_NBB_SKIPBACK); printf(LANG_NBB_SEARCH); if(guPermLevel>=12 && !guListMode) printf(LANG_NBB_NEW); if(uAllowMod(uOwner,uCreatedBy)) printf(LANG_NBB_MODIFY); if(guPermLevel>=12) printf(LANG_NBB_DELETE); if(uOwner) printf(LANG_NBB_LIST); printf(LANG_NBB_SKIPNEXT); printf(LANG_NBB_SKIPLAST); }//void ExttAuthorizeNavBar(void) void tAuthorizeNavList(void) { MYSQL_RES *res; MYSQL_ROW field; sprintf(gcQuery,"SELECT uAuthorize,cLabel,uPerm,uCertClient FROM tAuthorize " " WHERE uOwner=%u OR uOwner IN (SELECT uClient FROM " TCLIENT " WHERE uOwner=%u)",guCompany,guCompany); mysql_query(&gMysql,gcQuery); if(mysql_errno(&gMysql)) { printf("%s",mysql_error(&gMysql)); return; } res=mysql_store_result(&gMysql); if(mysql_num_rows(res)) { printf("

tAuthorizeNavList
\n"); while((field=mysql_fetch_row(res))) printf("" "%s/%s/%s
\n",field[0],field[1],field[2],field[3]); } mysql_free_result(res); }//void tAuthorizeNavList(void)