IBDSecurity::SetPermissions Method [C++]

This method is used by the Permissions module and dialog box to set permission information (allow, deny, or undefined) for the specified combination of security identifier (SID), entity, element, and right.

Definition

[C++]

HRESULT IBDSecurity::SetPermissions(unsigned shortiPermission,
  BSTRbstrSID,
  VARIANTvarEntityVARIANTvarElementVARIANTvarRight);

[Visual Basic]

Sub SetPermissions(iPermission As Variant,
  bstrSID As String,
  OptionalvarEntity As Variant,
  OptionalvarElement As Variant,
  OptionalvarRight As Variant,
)

Parameters

  • iPermission[C++]
    [in] An unsigned short integer that specifies the permission to be set. See the Remarks section for more details.
  • iPermission[Visual Basic]
    A Variant that specifies the permission to be set. See the Remarks section for more details.
  • bstrSID[C++]
    [in] A BSTR that contains the security identifier (SID) of the account for which a permission is being set.
  • bstrSID[Visual Basic]
    A String that contains the security identifier (SID) of the account for which a permission is being set.
  • varEntity[C++]
    [in, optional] An optional VARIANT that contains a string specifying the name of the entity for which a permission is being set.
  • varEntity[Visual Basic]
    An optional Variant that contains a string specifying the name of the entity for which a permission is being set.
  • varElement[C++]
    [in, optional] An optional VARIANT that contains a string specifying the name of the element for which a permission is being set.
  • varElement[Visual Basic]
    An optional Variant that contains a string specifying the name of the element for which a permission is being set.
  • varRight[C++]
    [in, optional] An optional VARIANT that contains a string specifying the name of the right for which a permission is being set.
  • varRight[Visual Basic]
    An optional Variant that contains a string specifying the name of the right for which a permission is being set.

Return Values

[C++] This method returns an HRESULT indicating whether it completed successfully. See the Error Values section for more details.

[Visual Basic] None.

Error Values

[C++] This method returns S_OK (0x00000000) to indicate success and standard COM HRESULT error values to indicate failure. For more information about standard COM errors, see Standard COM Errors. Additional information may be available using the global Err object, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return a text description of the error.

[Visual Basic] This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to standard COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors. Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

This method will not typically be called from any Commerce Server Business Desk modules other than the Permissions module and dialog box.

The parameter iPermission must contain one of three numeric values, defined in the following table.

Value Definition
0 Allow. The user or group indicated by the provided SID has the right to perform the operation indicated by the varElement, varEntity, and varRight parameters.
1 Deny. The user or group indicated by the provided SID does not have the right to perform the operation indicated by the varElement, varEntity, and varRight parameters.
2 Undefined.

If any of the optional parameters (varEntity, varElement, and varRight) are not provided, the corresponding column in the BDSecurityDefinitions table will be assigned the value NULL.

This method checks the Security Definitions Tables (SDT) to make sure that a row with the provided combination of SID, entity, element, and right does not already exist. If it does already exist, the existing permission value is overwritten with the value provided by the parameter iPermission. This is done to prevent the creation of redundant or contradictory rows in the SDT.

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

[Visual Basic]

Example

' sSID is a string containing the SID of the relevant account.
' g_MSCSBizDeskSecurityis the global BD security object 
' created in the page Global.asa.

' Will disallow the user(s) associated with the provided SID from
' performing edits within the "Shoes" category of product catalog.

call g_MSCSBizDeskSecurity.SetPermissions(1, sSID, "catalog_categories", _
                                          "Shoes", "edit")

See Also

[C++]BDSecurity Object

[Visual Basic]BDSecurity Object

Copyright © 2005 Microsoft Corporation.
All rights reserved.