I've to test my sharing code. In my test classs I have to test if user1 creates record then it is visible to all user(400)..for that I have to get all manager id(399 user) based on user1 id...
example user1----->user2(manager of user1)---->user(manager of user2)------>user3(manager of user3)........---->user400(manager of user 399)
Code Is:
public class Parrent{
public static List<Id> getAll(List<Id> ids){
List<Id> mIds = new List<Id>();
for(user u : [select ManagerId from user where id in:ids and ManagerId!=null])
mIds.add(u.ManagerId);
if(mIds.size()>0)
mIds.addAll(getAll(mIds));
return mIds;
}
}
If this code gets all manager id based on the user id
Thanks in advance
Karthick