cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove Access for already existing SecurityPrincipal

uwe_martschinke
Explorer
0 Kudos

Hi,

I'm currently writing a Java application using the SAP BO SDK to modify the user security for various objects on platform (applications, folders, ...). Everything works fine except for removing access from an already existing SecurityPrincipal.

Does someone know how to achieve this?

Thanks & Regards,

Thilo S.

Accepted Solutions (1)

Accepted Solutions (1)

DellSC
Active Contributor
0 Kudos

If you want to remove all access to an object for a specific security principal, I believe you have to go to the object itself and then do something like this:

ISecurityInfo2 si2 = obj.getSecurityInfo2();

IExplicitPrincipals ieps = si2.getExplicitPrincipals();

for (int i = ieps.size() - 1; i >=0; i--){

   IExplicitPrincipal iep = ieps.get(i);

   if (iep.getID() == <SI ID of security principal to be removed>{

       ieps.remove(i);

       break;

   }

}

I'm not sure whether the IExplicitPrincipals index starts at 1 or 0, so you may have to modify accordingly.

-Dell

uwe_martschinke
Explorer
0 Kudos

Hey Dell, thanks for your reply!

I already tried this approach, but my object only returns one ExplicitPrinciple, which is null. If I try to query the EffectivePrinciples instead, the result contains as many principals as the object shows in CMC. Unfortunately, most of these are also null, except for the groups "Administrators" and "Everyone". And, furthermore, IEffectivePrinciples does not support the method remove(int arg0).

I'm starting to believe that what I'm trying to do is impossible using the SDK...

If you have another idea how to solve this, I would be very thankful!

Thanks and regards,

Thilo S.

Joe_Peters
Active Contributor
0 Kudos

It wouldn't make sense to get a single null IExplicitPrincipal from IExplicitPrincipals.  Do you mean that you got zero records?  Assuming you used Dell's code exactly, where are you seeing a null?  And what's the size() of ieps?

Answers (1)

Answers (1)

Former Member
0 Kudos

What is the version of BO you are using?

Are you looking for removing an access level or a specific right?

Thanks,

Prithvi

uwe_martschinke
Explorer
0 Kudos

Hey Prithviraj, I'm using BO 4.1 and I'm trying to remove an access level.

Thanks and regards,

Thilo S.