Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #64 from nodes-vapor/feature/customizable-user
Browse files Browse the repository at this point in the history
Feature/customizable user
  • Loading branch information
siemensikkema authored Apr 24, 2018
2 parents 1118850 + dc97190 commit 4b16e08
Show file tree
Hide file tree
Showing 18 changed files with 565 additions and 463 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
jobs:
MacOS:
macos:
xcode: "9.0"
xcode: "9.3.0"
steps:
- checkout
- restore_cache:
Expand Down Expand Up @@ -30,7 +30,7 @@ jobs:
- .build
Linux:
docker:
- image: brettrtoomey/vapor-ci:0.0.1
- image: nodesvapor/vapor-ci:swift-4.1
steps:
- checkout
- restore_cache:
Expand Down
11 changes: 6 additions & 5 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ let package = Package(
name: "AdminPanelProvider",
dependencies: [
// Vapor
.Package(url: "https://github.com/vapor/vapor.git", majorVersion: 2),
.Package(url: "https://github.com/vapor/leaf-provider.git", majorVersion: 1),
.Package(url: "https://github.com/vapor/auth-provider.git", majorVersion: 1),
.Package(url: "https://github.com/vapor/leaf-provider.git", majorVersion: 1),
.Package(url: "https://github.com/vapor/vapor.git", majorVersion: 2),

// Nodes
.Package(url: "https://github.com/nodes-vapor/flash.git", majorVersion: 1),
.Package(url: "https://github.com/nodes-vapor/slugify.git", majorVersion: 1),
.Package(url: "https://github.com/nodes-vapor/storage.git", majorVersion: 0, minor: 4),
.Package(url: "https://github.com/nodes-vapor/paginator.git", majorVersion: 2, minor: 0),
.Package(url: "https://github.com/nodes-vapor/audit-provider.git", majorVersion: 0, minor: 1),
.Package(url: "https://github.com/nodes-vapor/forms.git", majorVersion: 0, minor: 7),
.Package(url: "https://github.com/nodes-vapor/paginator.git", majorVersion: 2, minor: 0),
.Package(url: "https://github.com/nodes-vapor/slugify.git", majorVersion: 1),
.Package(url: "https://github.com/nodes-vapor/storage.git", majorVersion: 0, minor: 4)
]
)
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Admin Panel ✍️
[![Swift Version](https://img.shields.io/badge/Swift-3-brightgreen.svg)](http://swift.org)
[![Swift Version](https://img.shields.io/badge/Swift-4.1-brightgreen.svg)](http://swift.org)
[![Vapor Version](https://img.shields.io/badge/Vapor-2-F6CBCA.svg)](http://vapor.codes)
[![Circle CI](https://circleci.com/gh/nodes-vapor/admin-panel-provider/tree/master.svg?style=shield)](https://circleci.com/gh/nodes-vapor/admin-panel-provider)
[![codebeat badge](https://codebeat.co/badges/2aa06de9-5bb5-4c2e-ad1a-ef6e08273184)](https://codebeat.co/projects/github-com-nodes-vapor-admin-panel-provider-master)
Expand All @@ -20,13 +20,6 @@ Admin Panel makes it easy to setup and maintain admin features for your Vapor pr

Update your `Package.swift` file:

#### Swift 3

```swift
.Package(url: "https://github.com/nodes-vapor/admin-panel-provider.git", majorVersion: 0, minor: 6)
```
#### Swift 4

```swift
.package(url: "https://github.com/nodes-vapor/admin-panel-provider.git", .upToNextMinor(from: "0.6.0")),
```
Expand Down
14 changes: 4 additions & 10 deletions Sources/AdminPanelProvider/Commands/Seeder.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import Vapor
import Console

typealias Seeder = CustomUserSeeder<AdminPanelUser>

/// Seeds the admin panel with a default user
public final class Seeder: Command, ConfigInitializable {
public final class CustomUserSeeder<U: AdminPanelUserType>: Command, ConfigInitializable {
public let id = "admin-panel:seeder"

public let help: [String] = [
Expand All @@ -18,15 +20,7 @@ public final class Seeder: Command, ConfigInitializable {
public func run(arguments: [String]) throws {
console.info("Started the seeder")

let user = try AdminPanelUser(
name: "Admin",
title: "Default admin account",
email: "admin@admin.com",
password: "admin",
role: "Super Admin",
shouldResetPassword: false,
avatar: nil
)
let user = try U.makeSeededUser()

try user.save()

Expand Down
Loading

0 comments on commit 4b16e08

Please sign in to comment.