public static function getNestedPermissionIds(string $permissionName)
    {
        if (self::isAdmin()) {
            return true;
        }

        $user           = \Craft::$app->getUser();
        $permissionName = strtolower($permissionName);
        $idList         = [];

        if (self::permissionsEnabled()) {
            if (!$user->getId()) {
                return [];
            }

            $permissionList = \Craft::$app->userPermissions->getPermissionsByUserId($user->getId());
            foreach ($permissionList as $permission) {
                if (strpos($permission, $permissionName) === 0) {
                    if (strpos($permission, ':') === false) {
                        continue;
                    }

                    list($name, $id) = explode(':', $permission);

                    $idList[] = $id;
                }
            }

            return $idList;
        }

        return self::isAdmin();
    }
public static function getNestedPermissionIds(string $permissionName)
    {
        if (self::isAdmin()) {
            return true;
        }

        $user           = \Craft::$app->getUser();
        $permissionName = strtolower($permissionName);
        $idList         = [];

        if (self::permissionsEnabled()) {
            if (!$user->getId()) {
                return [];
            }

            $permissionList = \Craft::$app->userPermissions->getPermissionsByUserId($user->getId());
            foreach ($permissionList as $permission) {
                if (strpos($permission, $permissionName) === 0) {
                    if (strpos($permission, ':') === false) {
                        continue;
                    }

                    list($name, $id) = explode(':', $permission);

                    $idList[] = $id;
                }
            }

            return $idList;
        }

        return self::isAdmin();
    }
public static function getNestedPermissionIds ( string $ permissionName ) { if ( self :: isAdmin ( ) ) { return true ; } $ user = \ Craft :: $ app -> getUser ( ) ; $ permissionName = strtolower ( $ permissionName ) ; $ idList = [ ] ; if ( self :: permissionsEnabled ( ) ) { if ( ! $ user -> getId ( ) ) { return [ ] ; } $ permissionList = \ Craft :: $ app -> userPermissions -> getPermissionsByUserId ( $ user -> getId ( ) ) ; foreach ( $ permissionList as $ permission ) { if ( strpos ( $ permission , $ permissionName ) === 0 ) { if ( strpos ( $ permission , ':' ) === false ) { continue ; } list ( $ name , $ id ) = explode ( ':' , $ permission ) ; $ idList [ ] = $ id ; } } return $ idList ; } return self :: isAdmin ( ) ; }
Fetches all nested allowed permission IDs from a nested permission set

@param string $permissionName

@return array|bool
Fetches all nested allowed permission IDs from a nested permission set