]> BookStack Code Mirror - bookstack/blobdiff - app/helpers.php
Use joint_permissions to determine is a user has an available page or chapter to...
[bookstack] / app / helpers.php
index b0886d02b9762c27383e37f5b7989014607ed03c..383e25c1594e8eac7e5b1b3f6cb2f8d3c3fa8c6e 100644 (file)
@@ -65,6 +65,17 @@ function userCan($permission, Ownable $ownable = null)
     return $permissionService->checkOwnableUserAccess($ownable, $permission);
 }
 
+/**
+ * Check if the current user has the ability to create a page for an existing object
+ * @return bool
+ */
+function userCanCreatePage()
+{
+    // Check for create page permissions
+    $permissionService = app(\BookStack\Auth\Permissions\PermissionService::class);
+    return $permissionService->checkAvailableCreatePageAccess();
+}
+
 /**
  * Helper to access system settings.
  * @param $key