You can get the ID’s of all the currently logged in users by using this global function: UserInfo.getUserId().