com.ibm.commerce.usermanagement.commands

Class MemberRoleAssignCmdImpl

  • All Implemented Interfaces:
    AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, Protectable, MemberRoleAssignCmd, com.ibm.websphere.cache.Sizeable, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command, com.ibm.websphere.command.CommandCaller, com.ibm.websphere.command.TargetableCommand, java.io.Serializable


    public class MemberRoleAssignCmdImpl
    extends ControllerCommandImpl
    implements MemberRoleAssignCmd
    Assigns roles to a member in the context of an organizational entity. The member can be a user, organization or organizational unit.

    Assigning roles to an organizational entity controls what roles other users can have in this organizational entity. An organizational entity can only have a role if its parent organizational entity has that role. When assigning a role to an organizational entity, the memberId and organEntityId should be same.

    The assignment is stored in the MBRROLE table.

    Use this command with SSL (Secure Sockets Layer) to ensure that the information are encrypted. To do so type the command with the HTTPS secure protocol.

    The parameters URL and memberId are mandatory.

    Behavior

    • Calls an empty task command PreMemberRoleAssignCmd. Store Developers can overwrite it change the input to the command.
    • This command can assign multiple roles for one member in one command call according to different parameter combination.
    • The roleId parameter takes the forms like roleId, roleId1, roleId2..., the corresponding orgEntityId should be orgEntityId, orgEntiyId1, orgEntityId2...
    • If unassign roles for a user, after assign roles, the command will check if the user is a member of the SiteAdministrators group. If so, update RegisterType with an 'S'. If not, then check if the user is a member of the Administrators group. If so, update the RegisterType with an 'A'.
    • If the command fails, the GenericApplicationError view command is called. Upon successful completion, the specified URL is called.
    • Calls an empty task command PostMemberRoleAssignCmd. Store Developers can overwrite it to perform additional operations.

    Exception Conditions

    • memberId is null (_ERR_CMD_MISSING_PARAM).
    • memberId is not a valid orgEntityId or userId (_ERR_CMD_INVALID_PARAM).
    • roleId(#) is not valid (_ERR_CMD_INVALID_PARAM).
    • The parent of the member does not have the role. A member can only be assigned a role if its parent has been assigned the same role (_ERR_PARENT_NOT_IN_ROLE).
    • If memberId is a user, then for each roleId(#), the corresponding orgEntityId(#) should be specified, otherwise, an exception will be thrown (_ERR_CMD_MISSING_PARAM).
    • If memberId is an orgEntity, if the corresponding orgEntityId(#) is specified but not equals to the memberId, an exception will be thrown(_ERR_INVALID_ORGENTITYID_IN_ROLEASSIGN). If the corresponding orgEntityId(#) is not specified, it will default to be the same as the memberId.
    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM Copyright notice field.
        See Also:
        Constant Field Values
      • CLASSNAME

        public static final java.lang.String CLASSNAME
        The name of this implementation of the command.
        See Also:
        Constant Field Values
      • ALL_ASSIGNABLE_ROLES

        public static final java.lang.Integer ALL_ASSIGNABLE_ROLES
        Value in of Assignable Role column in Role Assignment Permission table to signify all available roles
    • Constructor Detail

      • MemberRoleAssignCmdImpl

        public MemberRoleAssignCmdImpl()
    • Method Detail

      • getCheckURL

        public boolean getCheckURL()
        Returns whether the URL needs to be specified.
        Specified by:
        getCheckURL in interface MemberRoleAssignCmd
        Returns:
        Whether the URL needs to be specified.
      • getMemberId

        public java.lang.String getMemberId()
        Returns the member identifier of the member having the role assigned to.
        Specified by:
        getMemberId in interface MemberRoleAssignCmd
        Returns:
        The member identifier.
      • getOrgEntities

        public java.util.Vector getOrgEntities()
        Returns a list organization entity identifiers.
        Specified by:
        getOrgEntities in interface MemberRoleAssignCmd
        Returns:
        A list organization entity identifiers.
      • getResources

        public AccessVector getResources()
                                  throws ECException
        Returns the resources that needs to be checked before the command is executed for access control.
        Specified by:
        getResources in interface ECCommand
        Overrides:
        getResources in class AbstractECTargetableCommand
        Returns:
        If an organization is specified, an AccessVector containing the organization will be returned. Otherwise, if a user is specified, null will be returned if the fine grain access control level check passes.
        Throws:
        ECException - if access is not allowed
      • getRoles

        public java.util.Vector getRoles()
        Returns a list of role identifiers.
        Specified by:
        getRoles in interface MemberRoleAssignCmd
        Returns:
        A list of role identifiers.
      • checkIsAllowed

        public void checkIsAllowed(AccessVector resource,
                                   java.lang.String action)
                            throws ECException
        Check if the access control by calling checkIsAllowed() in the super classes
        Parameters:
        resource - The resource.
        action - The action.
        Throws:
        ECException - ECApplicationException is thrown if authorization fails.
      • performExecute

        public void performExecute()
                            throws ECException
        Assigns the specified member to the specified role. Then calls the PostMemberRoleAssign command to execute some customized function after the member roles have been assigned.
        Specified by:
        performExecute in interface ECCommand
        Specified by:
        performExecute in interface com.ibm.websphere.command.TargetableCommand
        Overrides:
        performExecute in class AbstractECTargetableCommand
        Throws:
        ECException - If there was a problem assigning the member to the role or executing the PostMemberRoleAssign command.
      • reset

        public void reset()
        Resets the command to its original state so the object can be reused to assign a role to a member.
        Specified by:
        reset in interface MemberRoleAssignCmd
        Specified by:
        reset in interface com.ibm.websphere.command.Command
        Overrides:
        reset in class AbstractECTargetableCommand
      • setCheckURL

        public void setCheckURL(boolean abCheckURL)
        Sets whether the URL needs to be specified.
        Specified by:
        setCheckURL in interface MemberRoleAssignCmd
        Parameters:
        abCheckURL - whether the URL needs to be specified.
      • setMemberId

        public void setMemberId(java.lang.String astrMemberId)
        Sets the member identifier.
        Specified by:
        setMemberId in interface MemberRoleAssignCmd
        Parameters:
        astrMemberId - the member identifier.
      • setRequestProperties

        public void setRequestProperties(TypedProperty reqProperties)
                                  throws ECException
        Sets the request properties. This is done by calling ProcesRequestProperties command. Then the PreMemberRoleAssign is called for any preposing that may be needed before the role is assigned to the member.
        Specified by:
        setRequestProperties in interface ControllerCommand
        Overrides:
        setRequestProperties in class ControllerCommandImpl
        Parameters:
        reqProperties - the parameters passed to the command.
        Throws:
        ECException - If there were any invalid parameter specified or a problem indicated by the PreMemberRoeAssign command.
      • validateParameters

        public void validateParameters()
                                throws ECException
        Validates the parameters passed to the command before the role is assigned to the member. Validation consists of ensure that the member specified exists and determining whether it is an organization or a user. The it will verify the roles specified and find their corresponding organization.
        Specified by:
        validateParameters in interface ECCommand
        Overrides:
        validateParameters in class AbstractECTargetableCommand
        Throws:
        ECException - If either the role or the member does exist, an ECApplicationException will be thrown.