Skip to content

Commit

Permalink
Merge pull request #7 from rgasch/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
rgasch authored Nov 14, 2022
2 parents 4f051c1 + db0331c commit ff8b9bd
Show file tree
Hide file tree
Showing 5 changed files with 363 additions and 2 deletions.
151 changes: 151 additions & 0 deletions app/Policies/EmailPolicy.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<?php

namespace App\Policies;

use App\Models\User;
use Ramnzys\FilamentEmailLog\Models\Email;
use Illuminate\Auth\Access\HandlesAuthorization;

class EmailPolicy
{
use HandlesAuthorization;

/**
* Determine whether the user can view any models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function viewAny(User $user)
{
return $user->can('view_any_email');
}

/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $user
* @param \Ramnzys\FilamentEmailLog\Models\Email $email
* @return \Illuminate\Auth\Access\Response|bool
*/
public function view(User $user, Email $email)
{
return $user->can('view_email');
}

/**
* Determine whether the user can create models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function create(User $user)
{
return $user->can('create_email');
}

/**
* Determine whether the user can update the model.
*
* @param \App\Models\User $user
* @param \Ramnzys\FilamentEmailLog\Models\Email $email
* @return \Illuminate\Auth\Access\Response|bool
*/
public function update(User $user, Email $email)
{
return $user->can('update_email');
}

/**
* Determine whether the user can delete the model.
*
* @param \App\Models\User $user
* @param \Ramnzys\FilamentEmailLog\Models\Email $email
* @return \Illuminate\Auth\Access\Response|bool
*/
public function delete(User $user, Email $email)
{
return $user->can('delete_email');
}

/**
* Determine whether the user can bulk delete.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function deleteAny(User $user)
{
return $user->can('delete_any_email');
}

/**
* Determine whether the user can permanently delete.
*
* @param \App\Models\User $user
* @param \Ramnzys\FilamentEmailLog\Models\Email $email
* @return \Illuminate\Auth\Access\Response|bool
*/
public function forceDelete(User $user, Email $email)
{
return $user->can('force_delete_email');
}

/**
* Determine whether the user can permanently bulk delete.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function forceDeleteAny(User $user)
{
return $user->can('force_delete_any_email');
}

/**
* Determine whether the user can restore.
*
* @param \App\Models\User $user
* @param \Ramnzys\FilamentEmailLog\Models\Email $email
* @return \Illuminate\Auth\Access\Response|bool
*/
public function restore(User $user, Email $email)
{
return $user->can('restore_email');
}

/**
* Determine whether the user can bulk restore.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function restoreAny(User $user)
{
return $user->can('restore_any_email');
}

/**
* Determine whether the user can bulk restore.
*
* @param \App\Models\User $user
* @param \Ramnzys\FilamentEmailLog\Models\Email $email
* @return \Illuminate\Auth\Access\Response|bool
*/
public function replicate(User $user, Email $email)
{
return $user->can('replicate_email');
}

/**
* Determine whether the user can reorder.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function reorder(User $user)
{
return $user->can('reorder_email');
}

}
151 changes: 151 additions & 0 deletions app/Policies/FeatureFlagPolicy.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<?php

namespace App\Policies;

use App\Models\User;
use RyanChandler\LaravelFeatureFlags\Models\FeatureFlag;
use Illuminate\Auth\Access\HandlesAuthorization;

class FeatureFlagPolicy
{
use HandlesAuthorization;

/**
* Determine whether the user can view any models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function viewAny(User $user)
{
return $user->can('view_any_feature::flag');
}

/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $user
* @param \RyanChandler\LaravelFeatureFlags\Models\FeatureFlag $featureFlag
* @return \Illuminate\Auth\Access\Response|bool
*/
public function view(User $user, FeatureFlag $featureFlag)
{
return $user->can('view_feature::flag');
}

/**
* Determine whether the user can create models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function create(User $user)
{
return $user->can('create_feature::flag');
}

/**
* Determine whether the user can update the model.
*
* @param \App\Models\User $user
* @param \RyanChandler\LaravelFeatureFlags\Models\FeatureFlag $featureFlag
* @return \Illuminate\Auth\Access\Response|bool
*/
public function update(User $user, FeatureFlag $featureFlag)
{
return $user->can('update_feature::flag');
}

/**
* Determine whether the user can delete the model.
*
* @param \App\Models\User $user
* @param \RyanChandler\LaravelFeatureFlags\Models\FeatureFlag $featureFlag
* @return \Illuminate\Auth\Access\Response|bool
*/
public function delete(User $user, FeatureFlag $featureFlag)
{
return $user->can('delete_feature::flag');
}

/**
* Determine whether the user can bulk delete.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function deleteAny(User $user)
{
return $user->can('delete_any_feature::flag');
}

/**
* Determine whether the user can permanently delete.
*
* @param \App\Models\User $user
* @param \RyanChandler\LaravelFeatureFlags\Models\FeatureFlag $featureFlag
* @return \Illuminate\Auth\Access\Response|bool
*/
public function forceDelete(User $user, FeatureFlag $featureFlag)
{
return $user->can('force_delete_feature::flag');
}

/**
* Determine whether the user can permanently bulk delete.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function forceDeleteAny(User $user)
{
return $user->can('force_delete_any_feature::flag');
}

/**
* Determine whether the user can restore.
*
* @param \App\Models\User $user
* @param \RyanChandler\LaravelFeatureFlags\Models\FeatureFlag $featureFlag
* @return \Illuminate\Auth\Access\Response|bool
*/
public function restore(User $user, FeatureFlag $featureFlag)
{
return $user->can('restore_feature::flag');
}

/**
* Determine whether the user can bulk restore.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function restoreAny(User $user)
{
return $user->can('restore_any_feature::flag');
}

/**
* Determine whether the user can bulk restore.
*
* @param \App\Models\User $user
* @param \RyanChandler\LaravelFeatureFlags\Models\FeatureFlag $featureFlag
* @return \Illuminate\Auth\Access\Response|bool
*/
public function replicate(User $user, FeatureFlag $featureFlag)
{
return $user->can('replicate_feature::flag');
}

/**
* Determine whether the user can reorder.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function reorder(User $user)
{
return $user->can('reorder_feature::flag');
}

}
1 change: 0 additions & 1 deletion app/Policies/MenuPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public function view(User $user, Menu $menu)
* Determine whether the user can create models.
*
* @param \App\Models\User $user
* @param \io3x1\FilamentMenus\Models\Menu $menu
* @return \Illuminate\Auth\Access\Response|bool
*/
public function create(User $user)
Expand Down
1 change: 0 additions & 1 deletion app/Policies/RolePolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public function view(User $user, Role $role)
* Determine whether the user can create models.
*
* @param \App\Models\User $user
* @param \Spatie\Permission\Models\Role $role
* @return \Illuminate\Auth\Access\Response|bool
*/
public function create(User $user)
Expand Down
61 changes: 61 additions & 0 deletions public/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,64 @@
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

# ----------------------------------------------------------------------
# Expires headers (for better cache control)
# ----------------------------------------------------------------------

# These are pretty far-future expires headers.
# They assume you control versioning with filename-based cache busting
# Additionally, consider that outdated proxies may miscache
# www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/

# If you don't use filenames to version, lower the CSS and JS to something like
# "access plus 1 week".

<IfModule mod_expires.c>
ExpiresActive on

# Perhaps better to whitelist expires rules? Perhaps.
ExpiresDefault "access plus 1 month"

# cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)
ExpiresByType text/cache-manifest "access plus 0 seconds"

# Your document html
ExpiresByType text/html "access plus 0 seconds"

# Data
ExpiresByType application/json "access plus 0 seconds"
ExpiresByType application/xml "access plus 0 seconds"
ExpiresByType text/xml "access plus 0 seconds"

# Feed
ExpiresByType application/atom+xml "access plus 1 hour"
ExpiresByType application/rss+xml "access plus 1 hour"

# Favicon (cannot be renamed)
ExpiresByType image/x-icon "access plus 1 week"

# Media: images, video, audio
ExpiresByType audio/ogg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType video/mp4 "access plus 1 month"
ExpiresByType video/ogg "access plus 1 month"
ExpiresByType video/webm "access plus 1 month"

# HTC files (css3pie)
ExpiresByType text/x-component "access plus 1 month"

# Webfonts
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
ExpiresByType application/x-font-ttf "access plus 1 month"
ExpiresByType application/x-font-woff "access plus 1 month"
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"

# CSS and JavaScript
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType text/css "access plus 1 year"
</IfModule>

0 comments on commit ff8b9bd

Please sign in to comment.