protected function cachePermissions(Group $group) { $permissions = array(); // Overwrite parent permissions if those are set if ($group->parent_id) { $permissions = $this->cachePermissions($group->parent); } $permissions = array_unique(array_merge($permissions, $group->permissions()->get()->all())); // Cache for 14 days $this->cache->put('fluxbb.group.permissions.' . $group->id, $permissions, 20160); return $permissions; }
public function update(Group $group) { $rules = array('name' => 'required'); $validation = Validator::make(Input::all(), $rules); if ($validation->fails()) { return Redirect::route('admin_groups_edit', array('group' => $group))->withInput()->withErrors($validation); } else { $group->fill(Input::all()); $group->save(); return Redirect::route('admin_groups_edit', array('group' => $group))->with('success', 'Group was updated successfully.'); } }
protected function seedGroups() { // Insert the three preset groups $admin_group = Group::create(array('g_id' => Group::ADMIN, 'g_title' => trans('fluxbb::seed_data.administrators'), 'g_user_title' => trans('fluxbb::seed_data.administrator'), 'g_promote_min_posts' => 0, 'g_promote_next_group' => 0, 'g_moderator' => 0, 'g_mod_edit_users' => 0, 'g_mod_rename_users' => 0, 'g_mod_change_passwords' => 0, 'g_mod_ban_users' => 0, 'g_read_board' => 1, 'g_view_users' => 1, 'g_post_replies' => 1, 'g_post_topics' => 1, 'g_edit_posts' => 1, 'g_delete_posts' => 1, 'g_delete_topics' => 1, 'g_post_links' => 1, 'g_set_title' => 1, 'g_search' => 1, 'g_search_users' => 1, 'g_send_email' => 1, 'g_post_flood' => 0, 'g_search_flood' => 0, 'g_email_flood' => 0, 'g_report_flood' => 0)); $moderator_group = Group::create(array('g_id' => Group::MOD, 'g_title' => trans('fluxbb::seed_data.moderators'), 'g_user_title' => trans('fluxbb::seed_data.moderator'), 'g_promote_min_posts' => 0, 'g_promote_next_group' => 0, 'g_moderator' => 1, 'g_mod_edit_users' => 1, 'g_mod_rename_users' => 1, 'g_mod_change_passwords' => 1, 'g_mod_ban_users' => 1, 'g_read_board' => 1, 'g_view_users' => 1, 'g_post_replies' => 1, 'g_post_topics' => 1, 'g_edit_posts' => 1, 'g_delete_posts' => 1, 'g_delete_topics' => 1, 'g_post_links' => 1, 'g_set_title' => 1, 'g_search' => 1, 'g_search_users' => 1, 'g_send_email' => 1, 'g_post_flood' => 0, 'g_search_flood' => 0, 'g_email_flood' => 0, 'g_report_flood' => 0)); $member_group = Group::create(array('g_id' => Group::MEMBER, 'g_title' => trans('fluxbb::seed_data.members'), 'g_user_title' => null, 'g_promote_min_posts' => 0, 'g_promote_next_group' => 0, 'g_moderator' => 0, 'g_mod_edit_users' => 0, 'g_mod_rename_users' => 0, 'g_mod_change_passwords' => 0, 'g_mod_ban_users' => 0, 'g_read_board' => 1, 'g_view_users' => 1, 'g_post_replies' => 1, 'g_post_topics' => 1, 'g_edit_posts' => 1, 'g_delete_posts' => 1, 'g_delete_topics' => 1, 'g_post_links' => 1, 'g_set_title' => 0, 'g_search' => 1, 'g_search_users' => 1, 'g_send_email' => 1, 'g_post_flood' => 60, 'g_search_flood' => 30, 'g_email_flood' => 60, 'g_report_flood' => 60)); }