示例#1
0
 public function getDropdownOptions($fieldName = null, $keyValue = null)
 {
     $options = [];
     $manager = PluginManager::instance();
     if ($manager->exists('shahiemseymor.roles')) {
         $permissions = \ShahiemSeymor\Roles\Models\UserPermission::get();
         foreach ($permissions as $permission) {
             $options[$permission->id] = $permission->name;
         }
     }
     return $options;
 }
示例#2
0
 public function run()
 {
     $manager = PluginManager::instance();
     if ($manager->exists('shahiemseymor.roles')) {
         if (!\ShahiemSeymor\Roles\Models\UserPermission::where('name', '=', 'calendar_public')->first()) {
             \ShahiemSeymor\Roles\Models\UserPermission::create(['name' => 'calendar_public']);
         }
         if (!\ShahiemSeymor\Roles\Models\UserPermission::where('name', '=', 'calendar_deny_all')->first()) {
             \ShahiemSeymor\Roles\Models\UserPermission::create(['name' => 'calendar_deny_all']);
         }
     }
 }
示例#3
0
 public function index_onDelete()
 {
     if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) {
         foreach ($checkedIds as $permissionId) {
             if (!($permission = UserPermission::find($permissionId))) {
                 continue;
             }
             $permission->delete();
         }
         Flash::success('The permission has been deleted successfully.');
     }
     return $this->listRefresh();
 }