Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [SF] Uprawnienie
Randallmaster
post
Post #1





Grupa: Zarejestrowani
Postów: 677
Pomógł: 11
Dołączył: 18.11.2009

Ostrzeżenie: (0%)
-----


Witam,

W jaki sposób mogę nadać uprawnienia tylko dla edycji danej klasy, nie ważne co jest edytowane?

Przykładowo chcę nadać możliwość edycji dla przykładu: /admin/blog/3/edit

Zrobiłem to za pomocą:
  1. // creating the ACL
  2. $aclProvider = $this->get('security.acl.provider');
  3. $objectIdentity = ObjectIdentity::fromDomainObject($post);
  4. $acl = $aclProvider->createAcl($objectIdentity);
  5.  
  6. // retrieving the security identity of the currently logged-in user
  7. $tokenStorage = $this->get('security.token_storage');
  8. $user = $tokenStorage->getToken()->getUser();
  9. $securityIdentity = UserSecurityIdentity::fromAccount($user);
  10.  
  11. // grant owner access
  12. $acl->insertObjectAce($securityIdentity, MaskBuilder::MASK_OWNER);
  13. $aclProvider->updateAcl($acl);


Problem jest w tym że nadaje mi uprawnienie do edycji ale dla obiektu 3, a ja chciałbym aby uprawnienie dotyczyło wszystkich obiektów . Jak wejdę na obiekt inny niż 3 to już mnie wpuścić nie chce

Posługiwałem się tą dokumentacją: http://symfony.com/doc/current/cookbook/se...d-adding-an-ace

Ten post edytował Randallmaster 5.05.2016, 12:15:07
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.12.2025 - 19:23