Page 1 of 1

Security User Assign Issue

Posted: Wed May 18, 2016 6:27 pm
by jim wood
Guys,

I'm seeing an issue with trying to assign a user to a group. If I run the process and new manager has been added to a project it creates the group but does not assign the user. If I then run the process again (The group already exists) it still doesn't assign the user. Any idea what a) I'm doing wrong or b) what's the issue with my code. I took commitment issues out of it with the failure in the second run,

Jim.

Code: Select all

IF(vManager1Index<>0);
    # Obtain the user name of the person being assigned
    vManager1Name=Lower(DimNm(vManager1Dim,vManager1Index));
    vManager1User=IF(DimIx(vUserDim,'Active Directory/'|vManager1Name)<>0
                                    ,'Active Directory/'|vManager1Name
                                    ,'Active Directory\'|vManager1Name
                                   );
    # Set what the name of the group will be for this user
    vManager1Group=vManager1Name|'-GRP';
    # Check to see if the name matches a valid user ID
    IF(DimIx(vUserDim,vManager1User)<>0);
        # Check to see if the group already exists and adds it if it doesn't
        IF(DimIx(cSecGroupDim,vManager1Group)=0);
            AddGroup(vManager1Group);
            IF(iCounter=0);
                vTextArray='<br>'|vManager1Group|'</br>';
            Else;
                vTextArray=vTextArray|'<br>'|vManager1Group|'</br>';
            EndIF;
            iCounter=iCounter+1;
        EndIF;
        # after checking the group assign the user
        AssignClientToGroup(vManager1User,vManager1Group);
    EndIF;
EndIF;

Re: Security User Assign Issue

Posted: Wed May 18, 2016 6:29 pm
by jim wood
We're set to security mode 5 and these are local groups. The users are coming in through CAM. For some reason we have active directory users with either a \ or a /, hence the check in my code,

Jim.

Re: Security User Assign Issue

Posted: Wed May 18, 2016 6:45 pm
by gtonkin
HI Jim,
Had an issue recently with a process trying to do a similar thing i.e. add a group if did not exist and add the user to it in one process.
I ended up placing the

Code: Select all

AssignClientToGroup(vManager1User,vManager1Group);
in the epilog and triggering based on a flag.
Don't think you are doing anything wrong may just be a glitch that has crept in - my system where this happened is 10.2.2 FP4

Re: Security User Assign Issue

Posted: Thu May 19, 2016 1:53 pm
by jim wood
gtonkin wrote:HI Jim,
Had an issue recently with a process trying to do a similar thing i.e. add a group if did not exist and add the user to it in one process.
I ended up placing the

Code: Select all

AssignClientToGroup(vManager1User,vManager1Group);
in the epilog and triggering based on a flag.
Don't think you are doing anything wrong may just be a glitch that has crept in - my system where this happened is 10.2.2 FP4
Excellent shout my friend. I'll give it a try. We're on 10.1.1 so it may be something that crept in with version 10. I'll let you know how it goes,

Jim.

Re: Security User Assign Issue

Posted: Thu May 19, 2016 3:12 pm
by ardi
AssignClientToGroup works only on Data Tab or Epilog Tab

Re: Security User Assign Issue

Posted: Thu May 19, 2016 6:11 pm
by jim wood
ardi wrote:AssignClientToGroup works only on Data Tab or Epilog Tab
I do indeed have it within the metadata tab which explains why it's not working. I had to to originally do it this way as I have element assignments happening in the data tab. I have as suggested moved the user assignment to the epilog so we should be good. Thanks for your input guys.