How to assign permission with /pacage/myPacagecontloller.php to new user group.

Permalink
I read this and tried assign permission to user group with program, indicated by contents ID($cID).
http://www.concrete5.org/community/forums/customizing_c5/how-to-pro...
$page = CollectionType::getByHandle('home');
// $page = Page::getByID ('1'); it did not work.
$pkHandles = array();
$pkHandles[] = 'view_page';
$pkHandles[] = 'view_page_versions';
$pkHandles[] = 'edit_page_properties';
$pkHandles[] = 'edit_page_contents';
$pkHandles[] = 'approve_page_versions';
$pkHandles[] = 'move_or_copy_page';
$pkHandles[] = 'preview_page_as_user';
$pkHandles[] = 'add_subpage';
// $pkHandle = array( "canRead"=> true, "canWrite"=> true);  I want check the dashboad->permission control  readable and editable. 
$page->assignPermissions(Group::getByName('mycreateduser'), $pkHandles);

this permission to mygroup. to $cID = 1 and 2.
I plan to handle select pages by cID and name, like dashboad or home.


Could you help me?