예제 #1
0
bool UserUtilities::DeleteGroup(Group* group)
{
	int res = NetLocalGroupDel(NULL, group->m_StrGroupName);
	if(res == 0)
		return true;
	return false;
}
예제 #2
0
bool DeleteGroup(UserManager *panel,bool selection)
{
  bool res=false;
  CFarPanelSelection sp((HANDLE)panel,selection);
  if(sp.Number())
  {
    TCHAR warning[TINY_BUFFER];
    if(sp.Number()==1)
    {
      TCHAR Truncated[MAX_PATH];
      _tcscpy(Truncated,sp[0].FileName);
      FSF.TruncPathStr(Truncated,50);
      FSF.sprintf(warning,GetMsg(mDelOne),Truncated);
    }
    else
      FSF.sprintf(warning,GetMsg(mDelObjectN+NumberType(sp.Number())),sp.Number());
    const TCHAR *MsgItems[]={GetMsg(mButtonDelete),warning,GetMsg(mButtonDelete),GetMsg(mButtonCancel)};
    if(!Info.Message(&MainGuid,&DelGroupMessageGuid,0,NULL,MsgItems,sizeof(MsgItems)/sizeof(MsgItems[0]),2))
    {
      res=true;
      for(int i=0;i<sp.Number();i++)
      {
        if(sp[i].UserData.FreeData)
        {
          if(sp[i].FileAttributes&FILE_ATTRIBUTE_DIRECTORY)
          {
            if(panel->global)
            {
              NetGroupDel(panel->domain,GetWideNameFromUserData(sp[i].UserData.Data));
            }
            else
            {
              NetLocalGroupDel(panel->computer_ptr,GetWideNameFromUserData(sp[i].UserData.Data));
            }
          }
          else
            NetUserDel((panel->global)?(panel->domain):(panel->computer_ptr),GetWideNameFromUserData(sp[i].UserData.Data));
        }
      }
    }
  }
  return res;
}
예제 #3
0
파일: net.c 프로젝트: borland667/pbis
/**
 * Delete AD local group.
 *
 * @param appContext Application context reference.
 * @param aliasNameC Group name.
 * @return 0 on success; error code on failure.
 */
DWORD
AdtNetGroupDelete(
    IN AppContextTP appContext,
    IN PSTR aliasNameC
)
{
    DWORD dwError = ERROR_SUCCESS;
    PWSTR hostName = NULL;
    PWSTR aliasName = NULL;

    dwError = LwMbsToWc16s((PCSTR) (appContext->workConn->serverName), &hostName);
    ADT_BAIL_ON_ALLOC_FAILURE_NP(!dwError);

    dwError = LwMbsToWc16s((PCSTR) aliasNameC, &aliasName);
    ADT_BAIL_ON_ALLOC_FAILURE_NP(!dwError);

    PrintStderr(appContext, LogLevelTrace, "%s: Deleting group %s ...\n",
                appContext->actionName, aliasNameC);

    /* Perform the delete operation. */
    if(!appContext->gopts.isReadOnly) {
        dwError = NetLocalGroupDel((PCWSTR) hostName, (PCWSTR) aliasName);
    }

    if (dwError) {
        dwError += ADT_WIN_ERR_BASE;
        ADT_BAIL_ON_ERROR_NP(dwError);
    }

    PrintStderr(appContext, LogLevelTrace, "%s: Done deleting group %s\n",
                appContext->actionName, aliasNameC);

    cleanup:
        LW_SAFE_FREE_MEMORY(hostName);
        LW_SAFE_FREE_MEMORY(aliasName);

        return dwError;

    error:
        goto cleanup;
}
예제 #4
0
파일: groups.c 프로젝트: hoangduit/reactos
static BOOL
GroupDelete(HWND hwndDlg)
{
    TCHAR szGroupName[UNLEN];
    TCHAR szText[256];
    INT nItem;
    HWND hwndLV;
    NET_API_STATUS status;

    hwndLV = GetDlgItem(hwndDlg, IDC_GROUPS_LIST);
    nItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED);
    if (nItem == -1)
        return FALSE;

    /* Get the new group name */
    ListView_GetItemText(hwndLV,
                         nItem, 0,
                         szGroupName,
                         UNLEN);

    /* Display a warning message, because the delete operation cannot be reverted */
    wsprintf(szText, TEXT("Dou you really want to delete the user group \"%s\"?"), szGroupName);
    if (MessageBox(NULL, szText, TEXT("User Groups"), MB_ICONWARNING | MB_YESNO) == IDNO)
        return FALSE;

    /* Delete the group */
    status = NetLocalGroupDel(NULL, szGroupName);
    if (status != NERR_Success)
    {
        TCHAR szText[256];
        wsprintf(szText, TEXT("Error: %u"), status);
        MessageBox(NULL, szText, TEXT("NetLocalGroupDel"), MB_ICONERROR | MB_OK);
        return FALSE;
    }

    /* Delete the group from the list */
    (void)ListView_DeleteItem(hwndLV, nItem);

    return TRUE;
}
예제 #5
0
UINT removeAfsAdminGroup(void) {
    NET_API_STATUS status;
    status = NetLocalGroupDel(NULL, AFSCLIENT_ADMIN_GROUPNAMEW);
    return status;
}