public function run()
 {
     $now = Carbon::now();
     $permissions = [['name' => 'admin.adkats.bans.create', 'display_name' => 'Create New Bans', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.adkats.bans.edit', 'display_name' => 'Edit Bans', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.adkats.bans.view', 'display_name' => 'View Banlist', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.adkats.reports.edit', 'display_name' => 'Edit Admin Reports', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.adkats.reports.view', 'display_name' => 'View Admin Reports', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.adkats.settings.edit', 'display_name' => 'Edit AdKats Settings', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.adkats.special.edit', 'display_name' => 'Edit AdKats Special Players', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.adkats.special.view', 'display_name' => 'View AdKats Special Players', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.adkats.user.edit', 'display_name' => 'Edit AdKats Users', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.adkats.user.view', 'display_name' => 'View AdKats Users', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.adkats.roles.edit', 'display_name' => 'Edit AdKats Roles', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.adkats.roles.view', 'display_name' => 'View AdKats Roles', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.forgive', 'display_name' => 'Forgive Player', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.kick', 'display_name' => 'Kick Player', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.kickall', 'display_name' => 'Kick All Players', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.kill', 'display_name' => 'Kill Player', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.mute', 'display_name' => 'Mute Player', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.nuke', 'display_name' => 'Nuke Server', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.pban', 'display_name' => 'Perma Ban Player', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.punish', 'display_name' => 'Punish Player', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.say', 'display_name' => 'Say Message', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.tban', 'display_name' => 'Temp Ban Player', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.teamswitch', 'display_name' => 'Teamswitch Player', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.yell', 'display_name' => 'Yell Message', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.tell', 'display_name' => 'Tell Message (Sends both Say and Yell)', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.site.motd', 'display_name' => 'View Message of the Day', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.site.roles', 'display_name' => 'Manage Site Roles', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.site.settings.server', 'display_name' => 'Manage Server Settings', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.site.settings.site', 'display_name' => 'Manage Site Settings', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.site.users', 'display_name' => 'Manage Users', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.site.users.notify', 'display_name' => 'Receive emails on new user registration', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.site.system.logs', 'display_name' => 'View the application logs', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.player.special.add', 'display_name' => 'Add player to the special players table', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.player.special.remove', 'display_name' => 'Remove player from the special players table', 'created_at' => $now, 'updated_at' => $now], ['name' => 'chatlogs', 'display_name' => 'View Chatlogs', 'created_at' => $now, 'updated_at' => $now], ['name' => 'player.infractions.forgive', 'display_name' => 'Issue Forgive Points', 'created_at' => $now, 'updated_at' => $now], ['name' => 'player.view.guids', 'display_name' => 'View Player GUIDS', 'created_at' => $now, 'updated_at' => $now], ['name' => 'player.view.ip', 'display_name' => 'View Player IP', 'created_at' => $now, 'updated_at' => $now]];
     Permission::insert($permissions);
     Role::find(1)->permissions()->attach(Permission::lists('id'));
 }
Beispiel #2
0
 public function edit($id)
 {
     try {
         $role = Role::with('users', 'permissions')->findOrFail($id);
         $permissions = [];
         foreach (Permission::all() as $permission) {
             if (preg_match('/^admin\\.([a-z]+)/A', $permission->name, $matches)) {
                 // Uppercase the first letter
                 $key = ucfirst($matches[1]);
                 // Push to array
                 $permissions[$key][$permission->id] = $permission->display_name;
             } else {
                 // Push to array
                 $permissions['General'][$permission->id] = $permission->display_name;
             }
         }
         $page_title = Lang::get('navigation.admin.site.items.roles.items.edit.title', ['name' => $role->name]);
         return View::make('admin.site.roles.edit', compact('role', 'permissions', 'page_title'));
     } catch (ModelNotFoundException $e) {
         return Redirect::route('admin.site.roles.index')->withErrors([sprintf('Role #%u doesn\'t exist.', $id)]);
     }
 }
Beispiel #3
0
<?php

use BFACP\Account\Permission;
$adminPermsList = Cache::remember('admin.perm.list', 60 * 24, function () {
    $temp = [];
    foreach (Permission::all() as $permission) {
        if (preg_match('/^admin\\.([a-z]+)/A', $permission->name, $matches)) {
            $temp[$matches[1]][] = $permission->name;
            $temp['_admin'][] = $permission->name;
        }
    }
    return $temp;
});
Menu::make('MainNav', function ($menu) use($adminPermsList) {
    $menu->raw(strtoupper(Lang::get('navigation.main.title')), ['class' => 'header']);
    $menu->add(Lang::get('navigation.main.items.dashboard.title'), ['route' => 'home'])->prepend(HTML::faicon(Lang::get('navigation.main.items.dashboard.icon.fa'), true));
    $menu->add(Lang::get('navigation.main.items.scoreboard.title'), ['route' => 'servers.live'])->prepend(HTML::faicon(Lang::get('navigation.main.items.scoreboard.icon.fa'), true));
    if (Auth::check() && Auth::user()->ability(null, 'admin.adkats.bans.view')) {
        $menu->add(Lang::get('navigation.admin.adkats.items.banlist.title'), ['route' => 'admin.adkats.bans.index'])->prepend(HTML::ionicon(Lang::get('navigation.admin.adkats.items.banlist.icon.ion'), true));
    }
    $menu->add(Lang::get('navigation.main.items.playerlist.title'), ['route' => 'player.listing'])->prepend(HTML::faicon(Lang::get('navigation.main.items.playerlist.icon.fa'), true));
    // If the role can access the chatlogs we can add the item to the navigation list
    if (Auth::check() && Auth::user()->ability(null, 'chatlogs') || Config::get('bfacp.site.chatlogs.guest')) {
        $menu->add(Lang::get('navigation.main.items.chatlogs.title'), ['route' => 'chatlog.search'])->prepend(HTML::faicon(Lang::get('navigation.main.items.chatlogs.icon.fa'), true));
    }
    // Only show these if the user is logged in
    if (Auth::check()) {
        /*===============================================
          =            AdKats Admin Navigation            =
          ===============================================*/
        if (Auth::user()->ability(null, $adminPermsList['adkats'])) {
Beispiel #4
0
<?php

use BFACP\Account\Permission;
$adminPermsList = Cache::remember('admin.perm.list', 60 * 24, function () {
    $temp = [];
    $permissions = Permission::all();
    $permissions->each(function ($permission) use(&$temp) {
        if (preg_match('/^admin\\.([a-z]+)/A', $permission->name, $matches)) {
            $temp[$matches[1]][] = $permission->name;
            $temp['_admin'][] = $permission->name;
        }
    });
    return $temp;
});
$bfacp = App::make('bfadmincp');
Menu::make('MainNav', function ($menu) use($adminPermsList, $bfacp) {
    $menu->raw(strtoupper(Lang::get('navigation.main.title')), ['class' => 'header']);
    $menu->add(Lang::get('navigation.main.items.dashboard.title'), ['route' => 'home'])->prepend(HTML::faicon(Lang::get('navigation.main.items.dashboard.icon.fa'), true));
    $menu->add(Lang::get('navigation.main.items.scoreboard.title'), ['route' => 'servers.live'])->prepend(HTML::faicon(Lang::get('navigation.main.items.scoreboard.icon.fa'), true));
    if ($bfacp->isLoggedIn && $bfacp->user->ability(null, 'admin.adkats.bans.view')) {
        $menu->add(Lang::get('navigation.admin.adkats.items.banlist.title'), ['route' => 'admin.adkats.bans.index'])->prepend(HTML::ionicon(Lang::get('navigation.admin.adkats.items.banlist.icon.ion'), true));
    }
    $menu->add(Lang::get('navigation.main.items.playerlist.title'), ['route' => 'player.listing'])->prepend(HTML::faicon(Lang::get('navigation.main.items.playerlist.icon.fa'), true));
    // If the role can access the chatlogs we can add the item to the navigation list
    if ($bfacp->isLoggedIn && $bfacp->user->ability(null, 'chatlogs') || Config::get('bfacp.site.chatlogs.guest')) {
        $menu->add(Lang::get('navigation.main.items.chatlogs.title'), ['route' => 'chatlog.search'])->prepend(HTML::faicon(Lang::get('navigation.main.items.chatlogs.icon.fa'), true));
    }
    // Only show these if the user is logged in
    if ($bfacp->isLoggedIn) {
        /*===============================================
          =            Adkats Admin Navigation            =