]> BookStack Code Mirror - bookstack/blobdiff - app/Role.php
Added hidden public role to fit with new permissions system
[bookstack] / app / Role.php
index 3b930d113259af4105b5e1e68b6cdedb28c12e17..b331e93e43e7cf4b6109a2929be6dd18fa46969f 100644 (file)
@@ -72,4 +72,24 @@ class Role extends Model
     {
         return static::where('name', '=', $roleName)->first();
     }
+
+    /**
+     * Get the role object for the specified system role.
+     * @param $roleName
+     * @return mixed
+     */
+    public static function getSystemRole($roleName)
+    {
+        return static::where('system_name', '=', $roleName)->first();
+    }
+
+    /**
+     * GEt all visible roles
+     * @return mixed
+     */
+    public static function visible()
+    {
+        return static::where('hidden', '=', false)->orderBy('name')->get();
+    }
+
 }