trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DaveBirdsall <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request #660: TRAFODION [2137] Improve metadata acc...
Date Wed, 17 Aug 2016 21:54:56 GMT
Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/660#discussion_r75214865
  
    --- Diff: core/sql/generator/Generator.cpp ---
    @@ -1737,6 +1737,82 @@ TrafDesc * Generator::createConstrKeyColsDescs(Int32 numKeys,
       return first_key_desc;
     }
     
    +// ****************************************************************************
    +// This method creates a set of trafodion descriptors (TrafDesc) based on 
    +// ComTdbVirtTablePrivInfo 
    +//
    +// see ComTdb.h for a description of the ComTdbVirtTablePrivInfo
    +// see TrafDDLdesc.h for a description of TrafDesc for the priv_desc
    +// ****************************************************************************
    +TrafDesc * Generator::createPrivDescs( const ComTdbVirtTablePrivInfo * privInfo,
    +                                       Space * space)
    +{
    +  // When authorization is enabled, each object must have at least one grantee
    +  // - the system grant to the object owner
    +  std::vector<PrivMgrDesc> *privGrantees = privInfo[0].privmgr_desc_list;
    +  DCMPASSERT (privGrantees.size() > 0);
    + 
    +  TrafDesc * priv_desc = TrafAllocateDDLdesc(DESC_PRIV_TYPE, space);
    +  TrafDesc * first_grantee_desc = NULL;
    +  TrafDesc * prev_grantee_desc = NULL;
    +
    +  // generate a TrafPrivGranteeDesc for each grantee and
    +  // attach to the privileges descriptor (priv_desc)
    +  for (int i = 0; i < privGrantees->size(); i++)
    +    {
    +      PrivMgrDesc granteeDesc = (*privGrantees)[i];
    +      TrafDesc * curr_grantee_desc = TrafAllocateDDLdesc(DESC_PRIV_GRANTEE_TYPE, space);
    +      if (! first_grantee_desc)
    +        first_grantee_desc = curr_grantee_desc;
    +
    +      curr_grantee_desc->privGranteeDesc()->grantee = granteeDesc.getGrantee();
    +
    +      // generate a TrafPrivBitmap for the object level privs and
    +      // attach it to the privilege grantee descriptor (curr_grantee_desc)
    +      TrafDesc * bitmap_desc = TrafAllocateDDLdesc(DESC_PRIV_BITMAP_TYPE, space);
    +      PrivMgrCoreDesc objDesc = granteeDesc.getTablePrivs();
    +      bitmap_desc->privBitmapDesc()->columnOrdinal = -1;
    +      bitmap_desc->privBitmapDesc()->privBitmap = objDesc.getPrivBitmap().to_ulong();
    +      bitmap_desc->privBitmapDesc()->privWGOBitmap = objDesc.getWgoBitmap().to_ulong();
    +      curr_grantee_desc->privGranteeDesc()->objectBitmap = bitmap_desc;
    +
    +      // generate a list of TrafPrivBitmapDesc, one for each column and
    +      // attach it to the TrafPrivGranteeDesc
    +      std::vector<PrivMgrCoreDesc> colDescList = granteeDesc.getColumnPrivs();
    --- End diff --
    
    Copy constructor. Should this be a reference instead?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message