]> gitweb.hamatoma.de Git - zentrum.gemeinwohl-gesellschaft.org.git/commitdiff
V0.1.1 User.php:
authorHamatoma <author@hamatoma.de>
Tue, 11 Mar 2025 10:29:21 +0000 (11:29 +0100)
committerHamatoma <author@hamatoma.de>
Tue, 11 Mar 2025 10:30:41 +0000 (11:30 +0100)
- User.php: +findRole() +hasRole() +isAdmin()

CHANGELOG.md
app/Models/User.php
composer.lock
lang/de_DE.json

index 58d6198daa5e43ba31034cf5f629749b3705bd2a..d20d1405517d9a6422ce5f83cae48ae8937bae25 100644 (file)
@@ -1 +1,5 @@
-# Change log of zentrum
+# Ă„nderungen an zentrum
+
+# V0.1.1
+- User.php: +findRole() +hasRole() +isAdmin()
+
index 20ab419aed25b26b97338aeec5d6d6922ae665ac..14563943eac6786d6a17cb37d1ed96eded71d17a 100644 (file)
@@ -48,4 +48,38 @@ class User extends Authenticatable
             
         ];
     }
+    /**
+     * Returns the role of the user.
+     * 
+     * @return Role the role of the user
+     */
+    protected function findRole()
+    {
+        if ($this->role == null){
+            $this->role = Role::find($this->role_id);
+        }
+        return $this->role;
+    }
+    /**
+     * Tests whether the user has a role with a priority less than or equal to the given priority.  The lower the priority, the more powerful the role.
+     * @param int $priority the priority to test against
+     * @return bool True if the user has a role with a priority less than or equal to the given priority, False otherwise
+     */
+    public function hasRole(int $priority): bool
+    {
+        $role = $this->findRole();
+        $rc = $this->role->priority <= $priority;
+        return $rc;
+    }
+    /**
+     * Tests whether the user is an admin.
+
+     * @return bool True if the user is an admin, False otherwise
+     */
+    public function isAdmin(): bool
+    {
+        $this->findRole();
+        $rc = $this->role->priority <= 19;
+        return $rc;
+    }
 }
index eb47940f1e6ac799691205761fa8cc61d9544aa2..02b382f590cb9efaede757b3fa0bae36fd51941e 100644 (file)
         },
         {
             "name": "laravel/pint",
-            "version": "v1.21.0",
+            "version": "v1.21.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/laravel/pint.git",
-                "reference": "531fa0871fbde719c51b12afa3a443b8f4e4b425"
+                "reference": "c44bffbb2334e90fba560933c45948fa4a3f3e86"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/laravel/pint/zipball/531fa0871fbde719c51b12afa3a443b8f4e4b425",
-                "reference": "531fa0871fbde719c51b12afa3a443b8f4e4b425",
+                "url": "https://api.github.com/repos/laravel/pint/zipball/c44bffbb2334e90fba560933c45948fa4a3f3e86",
+                "reference": "c44bffbb2334e90fba560933c45948fa4a3f3e86",
                 "shasum": ""
             },
             "require": {
                 "php": "^8.2.0"
             },
             "require-dev": {
-                "friendsofphp/php-cs-fixer": "^3.68.5",
-                "illuminate/view": "^11.42.0",
-                "larastan/larastan": "^3.0.4",
+                "friendsofphp/php-cs-fixer": "^3.70.2",
+                "illuminate/view": "^11.44.1",
+                "larastan/larastan": "^3.1.0",
                 "laravel-zero/framework": "^11.36.1",
                 "mockery/mockery": "^1.6.12",
                 "nunomaduro/termwind": "^2.3",
                 "issues": "https://github.com/laravel/pint/issues",
                 "source": "https://github.com/laravel/pint"
             },
-            "time": "2025-02-18T03:18:57+00:00"
+            "time": "2025-03-11T03:22:21+00:00"
         },
         {
             "name": "laravel/sail",
index 846eb16393651b8a4a1ea914e51dffa2438ffa20..0f773ddcdd9fb25f167d5637c0127dbe1d7c8c22 100644 (file)
@@ -17,6 +17,7 @@
     "All": "Alle",
     "Amount": "Betrag",
     "Analysis": "Analyse",
+    "Article": "Artikel",
     "Assign Roles": "Rollen zuordnen",
     "Back": "Zur\u00fcck",
     "Body": "Info",
@@ -91,6 +92,7 @@
     "Duration": "Dauer",
     "Duration (minutes)": "Dauer (Minuten)",
     "Email": "Email",
+    "Email has been sent if the email address is known.": "Email wurde gesendet, wenn die Emailadresse bekannt ist.",
     "Email\/Phone": "Email\/Telefon",
     "English (Britisch)": "Englisch (GB)",
     "Exchange of a File": "Austausch einer Datei",
     "Files": "Dateien",
     "Filtered": "Gefiltert",
     "Firstname": "Vorname",
+    "Forgotten Password?": "Passwort vergessen?",
     "French (France)": "Franz\u00f6sisch (Frankreich)",
     "Fri": "Fr",
     "From": "Von",