EssSetDatabaseAccessEx

データベースへのユーザー・アクセスに関する情報を含む、ユーザーのデータベース・アクセス構造体のリストを設定します。EssSetDatabaseAccessに似ていますが、入力構造体には、ユーザー・ディレクトリおよび一意のID属性を含められます。

構文

            ESS_FUNC_M EssSetDatabaseAccessEx (
            hCtx
            , 
            Count
            , 
            pUserDb
            );
         
パラメータデータ型説明

hCtx

ESS_HCTX_T

APIコンテキスト・ハンドル(入力)。

Count

ESS_USHORT_T

ユーザー・データベース構造体のカウント(入力)。

pUserDb

ESS_PUSERDBEX_T

ユーザー・データベース構造体の配列へのポインタ(入力)。

備考

ユーザー・データベース構造体のAccessフィールドを使用して、ユーザーに付与されたデータベースへのアクセスを設定します。この呼出しではMaxAccessFilterNameフィールドは無視されます。

戻り値

なし。

アクセス

この関数を使用するには、呼出し元が、指定したデータベースに対してデータベース・デザイン権限(ESS_PRIV_DBDESIGN)を持っている必要があります。

         

void DisplayUserDbInfo(ESS_PUSERDBEX_T userDb, ESS_USHORT_T count)
{
   ESS_STS_T sts = ESS_STS_NOERR;
   ESS_USHORT_T ind;

   printf ("\n------Database Access List----\n\n");    
   for (ind = 0; ind < count; ind++)
   {
      printf("\tUser: %s\n", userDb[ind].UserName);
      printf("\tProvider Name: %s\n", userDb[ind].ProviderName);
      printf("\tConnection Param: %s\n", userDb[ind].connparam);
      printf("\tApp Name: %s\n", userDb[ind].AppName);
      printf("\tDb Name: %s\n", userDb[ind].DbName);
      switch(userDb[ind].Access)
      {
         case ESS_PRIV_NONE:
            printf("\tAccess: %d - ESS_PRIV_NONE\n", userDb[ind].Access);
            break;
         case ESS_PRIV_READ:
            printf("\tAccess: %d - ESS_PRIV_READ\n", userDb[ind].Access);
            break;
         case ESS_PRIV_WRITE:
            printf("\tAccess: %d - ESS_PRIV_WRITE\n", userDb[ind].Access);
            break;
         case ESS_PRIV_CALC:
            printf("\tAccess: %d - ESS_PRIV_CALC\n", userDb[ind].Access);
            break;
         case ESS_PRIV_METAREAD:
            printf("\tAccess: %d - ESS_PRIV_METAREAD\n", userDb[ind].Access);
            break;
         case ESS_PRIV_DBLOAD:
            printf("\tAccess: %d - ESS_PRIV_DBLOAD\n", userDb[ind].Access);
            break;
         case ESS_PRIV_DBMANAGE:
            printf("\tAccess: %d - ESS_PRIV_DBMANAGE\n", userDb[ind].Access);
            break;
         case ESS_PRIV_DBCREATE:
            printf("\tAccess: %d - ESS_PRIV_DBCREATE\n", userDb[ind].Access);
            break;
         case ESS_PRIV_APPLOAD:
            printf("\tAccess: %d - ESS_PRIV_APPLOAD\n", userDb[ind].Access);
            break;
         case ESS_PRIV_APPMANAGE:
            printf("\tAccess: %d - ESS_PRIV_APPMANAGE\n", userDb[ind].Access);
            break;
         case ESS_PRIV_APPCREATE:
            printf("\tAccess: %d - ESS_PRIV_APPCREATE\n", userDb[ind].Access);
            break;
         case ESS_PRIV_USERCREATE:
            printf("\tAccess: %d - ESS_PRIV_USERCREATE\n", userDb[ind].Access);
            break;

         case ESS_ACCESS_READ:
            printf("\tAccess: %d - ESS_ACCESS_READ\n", userDb[ind].Access);
            break;
         case ESS_ACCESS_WRITE:
            printf("\tAccess: %d - ESS_ACCESS_WRITE\n", userDb[ind].Access);
            break;
         case ESS_ACCESS_CALC:
            printf("\tAccess: %d - ESS_ACCESS_CALC\n", userDb[ind].Access);
            break;
         case ESS_ACCESS_METAREAD:
            printf("\tAccess: %d - ESS_ACCESS_METAREAD\n", userDb[ind].Access);
            break;
         case ESS_ACCESS_DBMANAGE:
            printf("\tAccess: %d - ESS_ACCESS_DBMANAGE\n", userDb[ind].Access);
            break;
         case ESS_ACCESS_DBCREATE:
            printf("\tAccess: %d - ESS_ACCESS_DBCREATE\n", userDb[ind].Access);
            break;
         case ESS_ACCESS_APPMANAGE:
            printf("\tAccess: %d - ESS_ACCESS_APPMANAGE\n", userDb[ind].Access);
            break;
         case ESS_ACCESS_APPCREATE:
            printf("\tAccess: %d - ESS_ACCESS_APPCREATE\n", userDb[ind].Access);
            break;
         case ESS_ACCESS_FILTER:
            printf("\tAccess: %d - ESS_ACCESS_FILTER\n", userDb[ind].Access);
            break;
         case ESS_ACCESS_DBALL:
            printf("\tAccess: %d - ESS_ACCESS_DBALL\n", userDb[ind].Access);
            break;
         case ESS_ACCESS_APPALL:
            printf("\tAccess: %d - ESS_ACCESS_APPALL\n", userDb[ind].Access);
            break;
         case ESS_ACCESS_ADMIN:
            printf("\tAccess: %d - ESS_ACCESS_ADMIN\n", userDb[ind].Access);
            break;
         default:
            printf("\tAccess: Unknown\n");
      }

      switch(userDb[ind].MaxAccess)
      {
         case ESS_PRIV_NONE:
            printf("\tMax Access: %d - ESS_PRIV_NONE\n", userDb[ind].MaxAccess);
            break;
         case ESS_PRIV_READ:
            printf("\tMax Access: %d - ESS_PRIV_READ\n", userDb[ind].MaxAccess);
            break;
         case ESS_PRIV_WRITE:
            printf("\tMax Access: %d - ESS_PRIV_WRITE\n", userDb[ind].MaxAccess);
            break;
         case ESS_PRIV_CALC:
            printf("\tMax Access: %d - ESS_PRIV_CALC\n", userDb[ind].MaxAccess);
            break;
         case ESS_PRIV_METAREAD:
            printf("\tMax Access: %d - ESS_PRIV_METAREAD\n", userDb[ind].MaxAccess);
            break;
         case ESS_PRIV_DBLOAD:
            printf("\tMax Access: %d - ESS_PRIV_DBLOAD\n", userDb[ind].MaxAccess);
            break;
         case ESS_PRIV_DBMANAGE:
            printf("\tMax Access: %d - ESS_PRIV_DBMANAGE\n", userDb[ind].MaxAccess);
            break;
         case ESS_PRIV_DBCREATE:
            printf("\tMax Access: %d - ESS_PRIV_DBCREATE\n", userDb[ind].MaxAccess);
            break;
         case ESS_PRIV_APPLOAD:
            printf("\tMax Access: %d - ESS_PRIV_APPLOAD\n", userDb[ind].MaxAccess);
            break;
         case ESS_PRIV_APPMANAGE:
            printf("\tMax Access: %d - ESS_PRIV_APPMANAGE\n", userDb[ind].MaxAccess);
            break;
         case ESS_PRIV_APPCREATE:
            printf("\tMax Access: %d - ESS_PRIV_APPCREATE\n", userDb[ind].MaxAccess);
            break;
         case ESS_PRIV_USERCREATE:
            printf("\tMax Access: %d - ESS_PRIV_USERCREATE\n", userDb[ind].MaxAccess);
            break;

         case ESS_ACCESS_READ:
            printf("\tMax Access: %d - ESS_ACCESS_READ\n", userDb[ind].MaxAccess);
            break;
         case ESS_ACCESS_WRITE:
            printf("\tMax Access: %d - ESS_ACCESS_WRITE\n", userDb[ind].MaxAccess);
            break;
         case ESS_ACCESS_CALC:
            printf("\tMax Access: %d - ESS_ACCESS_CALC\n", userDb[ind].MaxAccess);
            break;
         case ESS_ACCESS_METAREAD:
            printf("\tMax Access: %d - ESS_ACCESS_METAREAD\n", userDb[ind].MaxAccess);
            break;
         case ESS_ACCESS_DBMANAGE:
            printf("\tMax Access: %d - ESS_ACCESS_DBMANAGE\n", userDb[ind].MaxAccess);
            break;
         case ESS_ACCESS_DBCREATE:
            printf("\tMax Access: %d - ESS_ACCESS_DBCREATE\n", userDb[ind].MaxAccess);
            break;
         case ESS_ACCESS_APPMANAGE:
            printf("\tMax Access: %d - ESS_ACCESS_APPMANAGE\n", userDb[ind].MaxAccess);
            break;
         case ESS_ACCESS_APPCREATE:
            printf("\tMax Access: %d - ESS_ACCESS_APPCREATE\n", userDb[ind].MaxAccess);
            break;
         case ESS_ACCESS_FILTER:
            printf("\tMax Access: %d - ESS_ACCESS_FILTER\n", userDb[ind].MaxAccess);
            break;
         case ESS_ACCESS_DBALL:
            printf("\tMax Access: %d - ESS_ACCESS_DBALL\n", userDb[ind].MaxAccess);
            break;
         case ESS_ACCESS_APPALL:
            printf("\tMax Access: %d - ESS_ACCESS_APPALL\n", userDb[ind].MaxAccess);
            break;
         case ESS_ACCESS_ADMIN:
            printf("\tMax Access: %d - ESS_ACCESS_ADMIN\n", userDb[ind].MaxAccess);
            break;
         default:
            printf("\tMax Access: Unknown\n");
      }

      printf("\tFilter Name: %s\n", userDb[ind].FilterName);
      printf("\n");
   }
}

ESS_FUNC_M ESS_SetDatabaseAccessEx (ESS_HCTX_T hCtx, ESS_HINST_T hInst)

{
   ESS_STS_T sts = ESS_STS_NOERR;
   ESS_STR_T userId;
   ESS_BOOL_T bIsIdentity;
   ESS_USHORT_T type;
   ESS_USHORT_T count;
   ESS_USERDBEX_T userDb[2];
   ESS_PUSERDBEX_T pUserDb = ESS_NULL;

   memset(&userDb, '\0', sizeof(userDb));


   count = 1;
   strcpy(userDb[0].UserName, "IDUser1");
   strcpy(userDb[0].ProviderName, "");
   strcpy(userDb[0].connparam, "");
   userDb[0].type = ESS_TYPE_USER;
   strcpy(userDb[0].AppName, AppName);
   strcpy(userDb[0].DbName, DbName);
   userDb[0].Access = ESS_PRIV_READ;
   userDb[0].MaxAccess = ESS_PRIV_READ;
   sts = EssSetDatabaseAccessEx(hCtx, count, &userDb);
   printf("EssSetDatabaseAccessEx sts: %ld\n\n", sts);
   if(!sts)
   {
      sts = EssGetDatabaseAccessEx(hCtx, userId, bIsIdentity, type, AppName, DbName, &count, &pUserDb);
      printf("EssGetDatabaseAccessEx sts: %ld\n", sts);
      if(!sts)
      {
         if(count && pUserDb)
         {  
            DisplayUserDbInfo(pUserDb, count);         
            sts = EssFree (hInst, pUserDb);        
         }
         else
            printf ("\rUser Application list is empty\n\n");    
      }
   }


   return (sts);
}
      

関連トピック