githubjeka
Repos
132
Followers
134

[WIP] PHP Time library

0
0

Simple and base functional to start using Enum in PHP projects

0
1

Events

Created at 14 hours ago
Created at 14 hours ago
Created at 14 hours ago
Docker Hub 5.26.0 tag

Please add v5.26 tag.

Created at 1 week ago
Created at 2 weeks ago
delete branch
githubjeka delete branch readme
Created at 2 weeks ago

feat: Added Sorter::sortInstants()

Created at 2 weeks ago

feat: Added HasInstant interface

Created at 2 weeks ago

feat: Added require-dev

Created at 2 weeks ago

test: Fix tests for php 7.3

Created at 2 weeks ago
create branch
githubjeka create branch php73
Created at 2 weeks ago

Update README.md

Co-authored-by: Alexander Makarov sam@rmcreative.ru

Created at 2 weeks ago
Created at 2 weeks ago
delete branch
githubjeka delete branch sch-session
Created at 1 month ago
pull request closed
feat: Added support to set a scheme for keys of Session

| Q | A | ------------- | --- | Is bugfix? | ❌ | New feature? | ✔️ | Breaks BC? | ❌

see https://redis.io/docs/data-types/tutorial/#keys

Now session in Redis storage like list of keys image

Some GUI Redis support schema for key. Useful when big data.

image

But redis session component can't save data by schema for key. PR makes it possible

Created at 1 month ago
issue comment
feat: Added support to set a scheme for keys of Session

overworked

Created at 1 month ago
pull request opened
feat: Added support to set a scheme for keys of Session

| Q | A | ------------- | --- | Is bugfix? | ❌ | New feature? | ✔️ | Breaks BC? | ❌

see https://redis.io/docs/data-types/tutorial/#keys

Now session in Redis storage like list of keys image

Some GUI Redis support schema for key. Useful when big data.

image

But redis session component can't save data by schema for key. PR makes it possible

Created at 1 month ago
create branch
githubjeka create branch sch-session
Created at 1 month ago
Created at 1 month ago
opened issue
Concurrent working with storage
    public function testParallelExecution(): void
    {
        $storage = $this->createStorage();
        $sameStorage = $this->createStorage();

        $userId = 'reader A';
        $itemName = 'first-new-role-for-reader-a';
        $storage->add($itemName, $userId);

        $assignment = $sameStorage->get($itemName, $userId);
        $this->assertNotNull($assignment);
    }

this test filed

API should use files only and don't save in memory result. Or need to controll modification file time. But to get this time need to add a strategy - filemtime, filectime, fileatime ... each of them has individual subtleties in the settings.

Created at 1 month ago
opened issue
Saving createdAt and updatedAt of \Yiisoft\Rbac\Item

Like #50

https://github.com/yiisoft/rbac-php/blob/master/src/ItemsStorage.php#L211

$items = $this->loadFromFile($this->itemFile);
        $itemsMtime = @filemtime($this->itemFile);
        foreach ($items as $name => $item) {
            $this->items[$name] = $this
                ->getInstanceFromAttributes($item)
                ->withCreatedAt($itemsMtime)
                ->withUpdatedAt($itemsMtime);
        }

        foreach ($items as $name => $item) {
            if (isset($item['children'])) {
                foreach ($item['children'] as $childName) {
                    if ($this->hasItem($childName)) {
                        $this->children[$name][$childName] = $this->items[$childName];
                    }
                }
            }
        }

All items has the same time.

Created at 1 month ago
opened issue
Saving \Yiisoft\Rbac\Assignment::$createdAt

https://github.com/yiisoft/rbac-php/blob/master/src/AssignmentsStorage.php#L125

private function loadAssignments(): void
    {
        /**
         * @psalm-var array<string|int,string[]> $assignments
         */
        $assignments = $this->loadFromFile($this->assignmentFile);
        $modifiedTime = @filemtime($this->assignmentFile);
        foreach ($assignments as $userId => $roles) {
            foreach ($roles as $role) {
                /** @psalm-suppress InvalidPropertyAssignmentValue */
                $this->assignments[$userId][$role] = new Assignment((string)$userId, $role, $modifiedTime);
            }
        }
    }

All assignments has the same time. Need rewrite the structure assignments in assignments.php and save createdAt inside

userId => [
    [itemName, unixtime],
    [itemName, unixtime],
    ...
]
...
Created at 1 month ago
opened issue
Using Assignment in AssignmentsStorageInterface::add()

An assigment has the createdAt attribute and you can't control it in AssignmentsStorageInterface::add()

public function add(string $itemName, string $userId): void;

Usually inside this a storage method the time() is called.

For example, I found wrong logic with createdAt in php-rbac package and now hard to write a test for check it

How about rewrite this method

public function add(Assignment $assignment): void;
Created at 1 month ago
pull request opened
docs: Missed Middleware information

Without middleware request model is empy :(

Created at 1 month ago
create branch
githubjeka create branch readme
Created at 1 month ago
delete branch
githubjeka delete branch create-user1
Created at 1 month ago
delete branch
githubjeka delete branch create-user-unique
Created at 1 month ago
pull request opened
Updates tests

Just a few improvements

Created at 1 month ago

test: Updates tests

Created at 1 month ago
Created at 1 month ago