Skip to content

Instantly share code, notes, and snippets.

@furkankadioglu
Created July 23, 2016 21:35
Show Gist options
  • Save furkankadioglu/b1d2614e2366e23b89087416fcda3198 to your computer and use it in GitHub Desktop.
Save furkankadioglu/b1d2614e2366e23b89087416fcda3198 to your computer and use it in GitHub Desktop.
Roles Örneği
<?php
if($id == "generate-hierarchy")
{
/*
Demo Trainer ve Trainee için açıklamalar yetersiz kaldı.
Toplantıda bu konu sonraya ertelendi.
$owner = new Role;
$owner->name = 'Demo Trainer';
$owner->display_name = 'Demo Trainer';
$owner->save();
$owner = new Role;
$owner->name = 'Demo Enrolled Trainee';
$owner->display_name = 'Demo Enrolled Trainee';
$owner->save();
*/
$owner = new Role;
$owner->name = 'Super Admin';
$owner->display_name = 'Super Administrator';
$owner->save();
$perm1 = new Permission;
$perm1->name = 'Profile';
$perm1->display_name = 'Profile Access';
$perm1->description = 'Edit own profile; Search and Visit Other Profiles';
$perm1->save();
$perm2 = new Permission;
$perm2->name = 'Full Control of Bundled-Content';
$perm2->display_name = 'Full Control of Bundled-Content';
$perm2->description = '[Create/Edit/Save/Save As/Publish/Delete] for Programs/Chapters/Modules/Objects';
$perm2->save();
$perm3 = new Permission;
$perm3->name = 'Full Control of Free-Content';
$perm3->display_name = 'Full Control of Free-Content';
$perm3->description = '[Create/Edit/Save/Save As/Publish/Delete] for News/FAQs/Pearls/Announcements';
$perm3->save();
$perm4 = new Permission;
$perm4->name = 'Full Control of User and User Groups';
$perm4->display_name = 'Full Control of User and User Groups';
$perm4->description = 'Create/Edit/Save/Save As/Delete';
$perm4->save();
$perm5 = new Permission;
$perm5->name = 'Full Control of Program Management';
$perm5->display_name = 'Full Control of Program Management';
$perm5->description = 'Open/Suspend/Withdraw/Close';
$perm5->save();
$perm6 = new Permission;
$perm6->name = 'Full Access to Analytics and Assessments';
$perm6->display_name = 'Full Access to Analytics and Assessments';
$perm6->description = 'Real-Time Statistics; Full Dashboard and Reports; Full Access to Assessment and Gamification Data';
$perm6->save();
$perm7 = new Permission;
$perm7->name = 'Full Options for Communication';
$perm7->display_name = 'Full Options for Communication';
$perm7->description = 'Direct Messaging, SMS Sending, e-Mailing; Full ACCESS of Direct-Message Boxes of Trainer and Users';
$perm7->save();
$perm8 = new Permission;
$perm8->name = 'Approvals and Evaluations';
$perm8->display_name = 'Approvals and Evaluations';
$perm8->description = 'Approvals of Content Created by MENTORS/BUDDIES';
$perm8->save();
$owner->attachPermissions(array($perm1, $perm2, $perm3, $perm4, $perm5, $perm6, $perm7, $perm8));
/* SUPER ADMIN END */
$owner = new Role;
$owner->name = 'Admin';
$owner->display_name = 'Administrator';
$owner->save();
$owner->attachPermissions(array($perm1, $perm2, $perm3, $perm4, $perm5, $perm6, $perm7, $perm8));
/* ADMIN END */
$owner = new Role;
$owner->name = 'Trainer';
$owner->display_name = 'Group Trainer';
$owner->save();
// + Profile Copy
$perm17 = new Permission;
$perm17->name = 'Bundled-Content';
$perm17->display_name = 'Bundled-Content';
$perm17->description = '[Create/Edit/Save/Save As/Publish] for Programs/Chapters/Modules/Objects';
$perm17->save();
$perm28 = new Permission;
$perm28->name = 'Free-Content';
$perm28->display_name = 'Free-Content';
$perm28->description = '[Create/Edit/Save/Save As/Publish] for News/FAQs/Pearls/Announcements';
$perm28->save();
$perm18 = new Permission;
$perm18->name = 'Communication';
$perm18->display_name = 'Communication';
$perm18->description = 'For the Affiliated Users/User-Groups: [Direct Messaging, SMS Sending, e-Mailing]';
$perm18->save();
$perm19 = new Permission;
$perm19->name = 'Analytics and Assessments';
$perm19->display_name = 'Analytics and Assessments';
$perm19->description = 'General Dashboard and Reports; User-Based/User-Groups-Based Assessment and Gamification Data';
$perm19->save();
$perm20 = new Permission;
$perm20->name = 'Approvals and Evaluations Trainer';
$perm20->display_name = 'Approvals and Evaluations Trainer';
$perm20->description = 'Evaluation/Grading/Approval of “Task Object” and/or “Collaborative Object” Assignments performed by the Users/User-Groups';
$perm20->save();
$owner->attachPermissions(array($perm1, $perm17, $perm28, $perm18, $perm19, $perm20));
/* TRAINER END */
$owner = new Role;
$owner->name = 'Mentor';
$owner->display_name = 'Group Mentor';
$owner->save();
// + Profile Copy
// + Free Content Copy
$perm21 = new Permission;
$perm21->name = 'Communication Direct Message';
$perm21->display_name = 'Communication Direct Message';
$perm21->description = 'For the Affiliated Users/User-Groups: [Direct Messaging]';
$perm21->save();
$perm22 = new Permission;
$perm22->name = 'Analytics and Assessments General';
$perm22->display_name = 'Analytics and Assessments General';
$perm22->description = 'General Dashboard and Reports';
$perm22->save();
$owner->attachPermissions(array($perm1, $perm28, $perm21, $perm22));
/* MENTOR END */
$owner = new Role;
$owner->name = 'Buddy';
$owner->display_name = 'Group Buddy';
$owner->save();
// + Profile Copy
// + Free Content Copy
$perm23 = new Permission;
$perm23->name = 'Communication Direct Message and Mail';
$perm23->display_name = 'Communication Direct Message and Mail';
$perm23->description = 'For the Affiliated Users/User-Groups: [Direct Messaging, e-Mailing]';
$perm23->save();
// + Analytics and Assessments General
$owner->attachPermissions(array($perm1, $perm28, $perm23));
/* BUDDY END */
// + Profile Copy
$owner = new Role;
$owner->name = 'Trainee';
$owner->display_name = 'Trainee';
$owner->save();
$perm24 = new Permission;
$perm24->name = 'Participation and Access to Resources';
$perm24->display_name = 'Participation and Access to Resources';
$perm24->description = 'Assigned Courses/Open Courses ';
$perm24->save();
$perm25 = new Permission;
$perm25->name = 'Communication Direct Message and Notification';
$perm25->display_name = 'Communication Direct Message and Notification';
$perm25->description = 'For the Affiliated Users/User-Groups: [Direct Messaging, Notifications]';
$perm25->save();
// + Analytics and Assessments General
$owner->attachPermissions(array($perm1, $perm24, $perm25));
/* Trainee END */
$owner = new Role;
$owner->name = 'Visitor';
$owner->display_name = 'Visitor';
$owner->save();
$perm26 = new Permission;
$perm26->name = 'Show Open Pages';
$perm26->display_name = 'Show Open Pages';
$perm26->description = 'Can visit the all-open pages';
$perm26->save();
$perm27 = new Permission;
$perm27->name = 'Participate Demo Courses';
$perm27->display_name = 'Participate Demo Courses';
$perm27->description = 'Can participate in “demo” courses';
$perm27->save();
$owner->attachPermissions(array($perm26, $perm27));
/* Visitor END */
return "Done.";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment