void Browse_OnEndTask_Translate (HWND hDlg, LPTASKPACKET ptp) { LPBROWSE_PARAMS lpp; if ((lpp = (LPBROWSE_PARAMS)GetWindowLongPtr (hDlg, DWLP_USER)) != NULL) { if (!ptp->rc || !TASKDATA(ptp)->pAsidList || !TASKDATA(ptp)->pAsidList->cEntries) { ErrorDialog (ptp->status, (TASKDATA(ptp)->Type == TYPE_USER) ? IDS_ERROR_CANT_TRANSLATE_USER : IDS_ERROR_CANT_TRANSLATE_GROUP); Browse_Enable (hDlg, TRUE); } else { lpp->pObjectsSelected = TASKDATA(ptp)->pAsidList; TASKDATA(ptp)->pAsidList = NULL; // don't let FreeTaskPacket free this // Fill in {lpp->szName}, for convenience // lpp->szName[0] = TEXT('\0'); if (lpp->pObjectsSelected && lpp->pObjectsSelected->cEntries) { ULONG status; ASOBJPROP Properties; if (asc_ObjectPropertiesGet_Fast (g.idClient, g.idCell, lpp->pObjectsSelected->aEntries[0].idObject, &Properties, &status)) lstrcpy (lpp->szName, Properties.szName); } EndDialog (hDlg, IDOK); } } }
BOOL User_GetDisplayName (LPTSTR pszText, ASID idUser) { ASOBJPROP Properties; if (asc_ObjectPropertiesGet_Fast (g.idClient, g.idCell, idUser, &Properties)) { return User_GetDisplayName (pszText, &Properties); } else { return asc_ObjectNameGet_Fast (g.idClient, g.idCell, idUser, pszText); } }
LPTSTR GetActionDescription (LPASACTION pAction) { LPTSTR pszDesc = NULL; ULONG status; ASOBJPROP Properties; ASOBJPROP Properties2; switch (pAction->Action) { case ACTION_REFRESH: if (asc_ObjectPropertiesGet_Fast (g.idClient, g.idCell, pAction->u.Refresh.idScope, &Properties, &status)) { if (Properties.Type == TYPE_CELL) pszDesc = FormatString (IDS_ACTION_REFRESH_CELL, TEXT("%s"), Properties.szName); else if (Properties.Type == TYPE_SERVER) pszDesc = FormatString (IDS_ACTION_REFRESH_SERVER, TEXT("%s"), Properties.szName); } break; case ACTION_SCOUT: if (asc_ObjectPropertiesGet_Fast (g.idClient, g.idCell, pAction->u.Refresh.idScope, &Properties, &status)) { if (Properties.Type == TYPE_CELL) pszDesc = FormatString (IDS_ACTION_SCOUT_CELL, TEXT("%s"), Properties.szName); else if (Properties.Type == TYPE_SERVER) pszDesc = FormatString (IDS_ACTION_SCOUT_SERVER, TEXT("%s"), Properties.szName); } break; case ACTION_USER_CHANGE: if (asc_ObjectPropertiesGet_Fast (g.idClient, g.idCell, pAction->u.User_Change.idUser, &Properties, &status)) { pszDesc = FormatString (IDS_ACTION_USER_CHANGE, TEXT("%s"), Properties.szName); } break; case ACTION_USER_PW_CHANGE: if (asc_ObjectPropertiesGet_Fast (g.idClient, g.idCell, pAction->u.User_Pw_Change.idUser, &Properties, &status)) { pszDesc = FormatString (IDS_ACTION_USER_PW_CHANGE, TEXT("%s"), Properties.szName); } break; case ACTION_USER_UNLOCK: if (asc_ObjectPropertiesGet_Fast (g.idClient, g.idCell, pAction->u.User_Unlock.idUser, &Properties, &status)) { pszDesc = FormatString (IDS_ACTION_USER_UNLOCK, TEXT("%s"), Properties.szName); } break; case ACTION_USER_CREATE: pszDesc = FormatString (IDS_ACTION_USER_CREATE, TEXT("%s"), pAction->u.User_Create.szUser); break; case ACTION_USER_DELETE: if (asc_ObjectPropertiesGet_Fast (g.idClient, g.idCell, pAction->u.User_Delete.idUser, &Properties, &status)) { pszDesc = FormatString (IDS_ACTION_USER_DELETE, TEXT("%s"), Properties.szName); } break; case ACTION_GROUP_CHANGE: if (asc_ObjectPropertiesGet_Fast (g.idClient, g.idCell, pAction->u.Group_Change.idGroup, &Properties, &status)) { pszDesc = FormatString (IDS_ACTION_GROUP_CHANGE, TEXT("%s"), Properties.szName); } break; case ACTION_GROUP_MEMBER_ADD: if (asc_ObjectPropertiesGet_Fast (g.idClient, g.idCell, pAction->u.Group_Member_Add.idGroup, &Properties, &status)) { if (asc_ObjectPropertiesGet_Fast (g.idClient, g.idCell, pAction->u.Group_Member_Add.idUser, &Properties2, &status)) { pszDesc = FormatString (IDS_ACTION_GROUP_MEMBER_ADD, TEXT("%s%s"), Properties.szName, Properties2.szName); } } break; case ACTION_GROUP_MEMBER_REMOVE: if (asc_ObjectPropertiesGet_Fast (g.idClient, g.idCell, pAction->u.Group_Member_Remove.idGroup, &Properties, &status)) { if (asc_ObjectPropertiesGet_Fast (g.idClient, g.idCell, pAction->u.Group_Member_Remove.idUser, &Properties2, &status)) { pszDesc = FormatString (IDS_ACTION_GROUP_MEMBER_REMOVE, TEXT("%s%s"), Properties.szName, Properties2.szName); } } break; case ACTION_GROUP_RENAME: if (asc_ObjectPropertiesGet_Fast (g.idClient, g.idCell, pAction->u.Group_Rename.idGroup, &Properties, &status)) { pszDesc = FormatString (IDS_ACTION_GROUP_RENAME, TEXT("%s%s"), Properties.szName, pAction->u.Group_Rename.szNewName); } break; case ACTION_GROUP_CREATE: pszDesc = FormatString (IDS_ACTION_GROUP_CREATE, TEXT("%s"), pAction->u.Group_Create.szGroup); break; case ACTION_GROUP_DELETE: if (asc_ObjectPropertiesGet_Fast (g.idClient, g.idCell, pAction->u.Group_Delete.idGroup, &Properties, &status)) { pszDesc = FormatString (IDS_ACTION_GROUP_DELETE, TEXT("%s"), Properties.szName); } break; case ACTION_CELL_CHANGE: if (asc_ObjectPropertiesGet_Fast (g.idClient, g.idCell, g.idCell, &Properties, &status)) { pszDesc = FormatString (IDS_ACTION_CELL_CHANGE, TEXT("%s"), Properties.szName); } break; } return pszDesc; }
void User_GetColumn (ASID idObject, USERCOLUMN iCol, LPTSTR pszText, LPSYSTEMTIME pstDate, LONG *pcsec, COLUMNTYPE *pcType) { if (pszText) *pszText = TEXT('\0'); if (pstDate) memset (pstDate, 0x00, sizeof(SYSTEMTIME)); if (pcsec) *pcsec = 0; if (pcType) *pcType = ctALPHABETIC; ASOBJPROP Properties; if (asc_ObjectPropertiesGet_Fast (g.idClient, g.idCell, idObject, &Properties)) { switch (iCol) { case usrcolNAME: if (pcType) *pcType = ctALPHABETIC; if (pszText) User_GetDisplayName (pszText, &Properties); break; case usrcolFLAGS: if (pcType) *pcType = ctALPHABETIC; if (pszText) { if (Properties.u.UserProperties.fHaveKasInfo) { if (Properties.u.UserProperties.KASINFO.fIsAdmin) { GetString (pszText, IDS_USRFLAG_ADMIN); pszText = &pszText[ lstrlen(pszText) -1 ]; } if (Properties.u.UserProperties.KASINFO.fCanGetTickets) { GetString (pszText, IDS_USRFLAG_TICKET); pszText = &pszText[ lstrlen(pszText) -1 ]; } if (Properties.u.UserProperties.KASINFO.fEncrypt) { GetString (pszText, IDS_USRFLAG_ENCRYPT); pszText = &pszText[ lstrlen(pszText) -1 ]; } if (Properties.u.UserProperties.KASINFO.fCanChangePassword) { GetString (pszText, IDS_USRFLAG_CHANGEPW); pszText = &pszText[ lstrlen(pszText) -1 ]; } if (Properties.u.UserProperties.KASINFO.fCanReusePasswords) { GetString (pszText, IDS_USRFLAG_REUSEPW); pszText = &pszText[ lstrlen(pszText) -1 ]; } } } break; case usrcolADMIN: if (pcType) *pcType = ctALPHABETIC; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) GetString (pszText, (Properties.u.UserProperties.KASINFO.fIsAdmin) ? IDS_YES : IDS_NO); } break; case usrcolTICKET: if (pcType) *pcType = ctALPHABETIC; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) GetString (pszText, (Properties.u.UserProperties.KASINFO.fCanGetTickets) ? IDS_YES : IDS_NO); } break; case usrcolSYSTEM: if (pcType) *pcType = ctALPHABETIC; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) GetString (pszText, (Properties.u.UserProperties.KASINFO.fEncrypt) ? IDS_NO : IDS_YES); } break; case usrcolCHANGEPW: if (pcType) *pcType = ctALPHABETIC; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) GetString (pszText, (Properties.u.UserProperties.KASINFO.fCanChangePassword) ? IDS_YES : IDS_NO); } break; case usrcolREUSEPW: if (pcType) *pcType = ctALPHABETIC; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) GetString (pszText, (Properties.u.UserProperties.KASINFO.fCanReusePasswords) ? IDS_YES : IDS_NO); } break; case usrcolEXPIRES: if (pcType) *pcType = ctDATE; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) FormatTime (pszText, TEXT("%t"), &Properties.u.UserProperties.KASINFO.timeExpires); if (pstDate) memcpy (pstDate, &Properties.u.UserProperties.KASINFO.timeExpires, sizeof(SYSTEMTIME)); } break; case usrcolLASTPW: if (pcType) *pcType = ctDATE; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) FormatTime (pszText, TEXT("%t"), &Properties.u.UserProperties.KASINFO.timeLastPwChange); if (pstDate) memcpy (pstDate, &Properties.u.UserProperties.KASINFO.timeLastPwChange, sizeof(SYSTEMTIME)); } break; case usrcolLASTMOD: if (pcType) *pcType = ctDATE; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) FormatTime (pszText, TEXT("%t"), &Properties.u.UserProperties.KASINFO.timeLastMod); if (pstDate) memcpy (pstDate, &Properties.u.UserProperties.KASINFO.timeLastMod, sizeof(SYSTEMTIME)); } break; case usrcolLASTMODBY: if (pcType) *pcType = ctALPHABETIC; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) lstrcpy (pszText, Properties.u.UserProperties.KASINFO.szUserLastMod); } break; case usrcolLIFETIME: if (pcType) *pcType = ctELAPSED; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) FormatElapsedSeconds (pszText, Properties.u.UserProperties.KASINFO.csecTicketLifetime); if (pcsec) *pcsec = Properties.u.UserProperties.KASINFO.csecTicketLifetime; } break; case usrcolCDAYPW: if (pcType) *pcType = ctELAPSED; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) FormatElapsedSeconds (pszText, Properties.u.UserProperties.KASINFO.cdayPwExpire * csec1DAY); if (pcsec) *pcsec = Properties.u.UserProperties.KASINFO.cdayPwExpire * csec1DAY; } break; case usrcolCFAILLOGIN: if (pcType) *pcType = ctNUMERIC; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) wsprintf (pszText, TEXT("%lu"), Properties.u.UserProperties.KASINFO.cFailLogin); } break; case usrcolCSECLOCK: if (pcType) *pcType = ctELAPSED; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) FormatElapsedSeconds (pszText, Properties.u.UserProperties.KASINFO.csecFailLoginLock); if (pcsec) *pcsec = Properties.u.UserProperties.KASINFO.csecFailLoginLock; } break; case usrcolCGROUPMAX: if (pcType) *pcType = ctNUMERIC; if (Properties.u.UserProperties.fHavePtsInfo) { if (pszText) wsprintf (pszText, TEXT("%lu"), Properties.u.UserProperties.PTSINFO.cgroupCreationQuota); } break; case usrcolUID: if (pcType) *pcType = ctNUMERIC; if (Properties.u.UserProperties.fHavePtsInfo) { if (pszText) wsprintf (pszText, TEXT("%ld"), Properties.u.UserProperties.PTSINFO.uidName); } break; case usrcolOWNER: if (pcType) *pcType = ctALPHABETIC; if (Properties.u.UserProperties.fHavePtsInfo) { if (pszText) { if (Properties.u.UserProperties.PTSINFO.szOwner[0]) wsprintf (pszText, TEXT("%s (%ld)"), Properties.u.UserProperties.PTSINFO.szOwner, Properties.u.UserProperties.PTSINFO.uidOwner); else wsprintf (pszText, TEXT("%ld"), Properties.u.UserProperties.PTSINFO.uidOwner); } } break; case usrcolCREATOR: if (pcType) *pcType = ctALPHABETIC; if (Properties.u.UserProperties.fHavePtsInfo) { if (pszText) { if (Properties.u.UserProperties.PTSINFO.szCreator[0]) wsprintf (pszText, TEXT("%s (%ld)"), Properties.u.UserProperties.PTSINFO.szCreator, Properties.u.UserProperties.PTSINFO.uidCreator); else wsprintf (pszText, TEXT("%ld"), Properties.u.UserProperties.PTSINFO.uidCreator); } } break; } } }
EXPORTED BOOL ADMINAPI AfsAppLib_asc_ObjectPropertiesGet_Fast (UINT_PTR idClient, ASID idCell, ASID idObject, LPASOBJPROP pProperties, ULONG *pStatus) { return asc_ObjectPropertiesGet_Fast (idClient, idCell, idObject, pProperties, pStatus); }
void Browse_OnEndTask_EnumObjects (HWND hDlg, LPTASKPACKET ptp) { LPBROWSE_PARAMS lpp; size_t ii; if ((lpp = (LPBROWSE_PARAMS)GetWindowLongPtr (hDlg, DWLP_USER)) != NULL) { HWND hList = GetDlgItem (hDlg, IDC_BROWSE_LIST); FastList_Begin (hList); FastList_RemoveAll (hList); // If we were successful, we now have a list of all objects of the // appropriate type. However, the user may not want us to display // items which are on our pObjectsToSkip list; if not, convert the // later to a hashlist (for fast lookup) and remove the offending // entries from the former. // if (ptp->rc && TASKDATA(ptp)->pAsidList) { if ((IsDlgButtonChecked (hDlg, IDC_BROWSE_CHECK)) && (lpp->pObjectsToSkip)) { LPHASHLIST pListToSkip = New (HASHLIST); for (ii = 0; ii < lpp->pObjectsToSkip->cEntries; ++ii) pListToSkip->AddUnique ((PVOID)(lpp->pObjectsToSkip->aEntries[ii].idObject)); for (ii = 0; ii < TASKDATA(ptp)->pAsidList->cEntries; ) { if (pListToSkip->fIsInList ((PVOID)(TASKDATA(ptp)->pAsidList->aEntries[ii].idObject))) asc_AsidListRemoveEntryByIndex (&TASKDATA(ptp)->pAsidList, ii); else ii++; } Delete (pListToSkip); } } // OK, we're ready to go--populate that list! // for (ii = 0; ii < TASKDATA(ptp)->pAsidList->cEntries; ++ii) { ULONG status; ASOBJPROP Properties; if (!asc_ObjectPropertiesGet_Fast (g.idClient, g.idCell, TASKDATA(ptp)->pAsidList->aEntries[ii].idObject, &Properties, &status)) continue; TCHAR szName[ MAX_PATH ]; if (Properties.Type == TYPE_USER) User_GetDisplayName (szName, &Properties); else lstrcpy (szName, Properties.szName); FASTLISTADDITEM flai; memset (&flai, 0x00, sizeof(flai)); flai.iFirstImage = (Properties.Type == TYPE_USER) ? imageUSER : (Properties.Type == TYPE_GROUP) ? imageGROUP : IMAGE_NOIMAGE; flai.iSecondImage = IMAGE_NOIMAGE; flai.pszText = szName; FastList_AddItem (hList, &flai); } FastList_End (hList); lpp->fQuerying --; } }