]> BookStack Code Mirror - bookstack/blobdiff - app/helpers.php
Added auto-suggestions to tag names and values
[bookstack] / app / helpers.php
index 582e4e03ad56242ffabcfd1f11d5537be90ac938..fea67a09a4c8d047ac52617a1831f5bee0ef33bf 100644 (file)
@@ -31,7 +31,7 @@ if (!function_exists('versioned_asset')) {
 
 /**
  * Check if the current user has a permission.
- * If an ownable element is passed in the permissions are checked against
+ * If an ownable element is passed in the jointPermissions are checked against
  * that particular item.
  * @param $permission
  * @param \BookStack\Ownable $ownable
@@ -39,14 +39,13 @@ if (!function_exists('versioned_asset')) {
  */
 function userCan($permission, \BookStack\Ownable $ownable = null)
 {
-    if (!auth()->check()) return false;
     if ($ownable === null) {
         return auth()->user() && auth()->user()->can($permission);
     }
 
     // Check permission on ownable item
-    $restrictionService = app('BookStack\Services\RestrictionService');
-    return $restrictionService->checkEntityUserAccess($ownable, $permission);
+    $permissionService = app('BookStack\Services\PermissionService');
+    return $permissionService->checkEntityUserAccess($ownable, $permission);
 }
 
 /**