Pages

Banner 468 x 60px

 

Saturday, November 18, 2017

Copy Role Username using x++

0 comments
Copy Role Username using x++ :

static void assignRolesFromUserToUser(Args _args)
    {
        #define.fromUserId('Adit')
        #define.toUserId('Tyo')
        SecurityRole            securityRole;
        SecurityUserRole        securityUserRoleFrom,securityUserRoleTo;
        ;
        while select securityUserRoleFrom
            where   securityUserRoleFrom.User               == #fromUserId
                &&  securityUserRoleFrom.AssignmentStatus   == RoleAssignmentStatus::Enabled
            join securityRole
            where   securityRole.RecId                      == securityUserRoleFrom.SecurityRole
        {
            select securityUserRoleTo
                where securityUserRoleTo.SecurityRole == securityUserRoleFrom.SecurityRole &&
                    securityUserRoleTo.User == #toUserId;
            if (!securityUserRoleTo || securityUserRoleTo.AssignmentStatus != RoleAssignmentStatus::Enabled)
            {
                SysSecHelper::log('Adding ' + securityRole.Name);
                securityUserRoleTo.User = #toUserId;
                securityUserRoleTo.SecurityRole = securityRole.RecId;
                securityUserRoleTo.AssignmentMode = RoleAssignmentMode::Manual;
                securityUserRoleTo.AssignmentStatus = RoleAssignmentStatus::Enabled;
                if (SecuritySegregationOfDuties::assignUserToRole(securityUserRoleTo, null) )
                {
                    EePersonalDataAccessLogging::logUserRoleChange(securityRole.RecId,0, #toUserId, AddRemove::Add);
                }
                else
                {
                    SysSecHelper::log('Skipping ' + securityRole.Name);
                }
            }
            else
            {
                SysSecHelper::log('Skipping ' + securityRole.Name);
            }
        }
    }




0 comments:

A financial dimension value is based on the record and has been used on a transaction. You cannot delete the record

  SOLUTION delete in table DimensionAttributeLevelValue base on Bank Account  :  and Delete the Bank Account FINISH