36. 权限系统(上)

龹龵龲龮龭龩龨龤龣

龲龮龹龵龢龠龜龘龢龗龓龏龎龍龋龉龈龅龂龁龍齾齻齸齴齲齱齮龂齻齸齴齪齩齨齤齣齟齜齚齘齗齖齕龣齓齏齱齌齊齓齏齱齌齓齏齉齅齃齲齱齁鼾龈鼻鼺齪龁鼸龢龲龮龹龵鼷鼶鼳鼯齚鼫鼩齪鼨鼤鼣鼠龗齊齓齏齱齪齓齏齱齖鼜鼚鼨鼤鼗齓齏齊齓齏齱齪鼕鼒鼏鼩鼍鼉鼈龋鼄鼃齻龓龏齪鼂黾鼷黺黷鼜鼚齪黶黵黲黰齪鼯黮鼜鼚黭齪鼫鼩鼷齮黪齓齏齱黧黦齖齻齸齴黭齪黣黡齖鼜黠黜黚黙黗黖龢龲龮黒黏黍齴鼷黋齊齓齏齱黊黉黆黜黄龢黃黉齪黉黀黺鼚齮麾鼨鼤齪麼麹麷齚鼨鼤麵龭麴鼫鼩麰

drupal龢龲龮黒黏麖麒黠鼒鼤麎黖齃麊齩齁齻麉麈麄麹麎黖鼺齩齨黉麃麂麁鹽鹼鹸龣

鼚鹶黒黏龣齏鹳龎鹲鹯鼾齪鹭鼯齚鹪鹦鹣鹟鹛鹘麹齪鹖鼣鹓鹒鹑鹐龹龵鼂黾鼜鼚鹏龗黲黰鼜鼚

鹌鹉鹆鹅黒黏龣齏鹳龎黧黦鹌鹉鹆鹅鼾齪龗鼯鹂黙黃黒黏齪龎鹌鹉麈鹀鹆鹅鸼龓龏龍鹳鸻龗鸸齟龲麒黠龍鸵鸱龋麰

鹖齚鸮鸭龗鸫麎黖龢齪齨鼾黉鸩鸥鸡麖鸞鸛龢麎黖鼃齤齪鸙鸖齟鸓鸑龢鸭龮齪鸍黣鼚鹶黒黏齩龂麊鼍鸊鸉鹛鹌鹉鹆鹅黒黏齪鸇齱齮鸄鸂鷿鷼齪黭鷸鷵齩齪龈鼠鷱齖鷭鼒鼤鼤麎黖鼃鷩鷸齪齗鷱鷦黉麃鼾龈麂鷣齪鼾鷣鷩鷡鼚鹶黒黏齪龈鷣鷩鷡鹌鹉鹆鹅黒黏齪鷠龠鷟鷜鼍鷚鷸drupal龢黧黦鷙鷖齪龁鷕齟麎黖鼯鷒鷑鷒麰

鼚鹶黒黏龣

鼚鹶黒黏龗齏鹳龎鹲鹯鼾鼠龢齪鹲鹯龗鼜鼚龹龵龢鸄鷎黵鷊齪鼜黠鹲鹯鷈鷚麹鷟鷜鼷鷇鷃麈鹀麉麈鷁鼗鶿鶾鷈齪龎鼗黵鶽drupal麒黠龲龮黒黏齪龹龵鹲鹯龗龎鶹鸛kernel.request鸱鶥麹鹯鹲鹯鶢鶞鶝鶙鹉鷈鷚龣

鶢鶞鶝鶙鹉id龣router_listener

鸩龣Symfony\Component\HttpKernel\EventListener\RouterListener

鷈鷚鸥鸡龣onKernelRequest(GetResponseEvent $event)

鹼黃鵱鼍鵭鹳鹲鹯鶙鹉鼃鷈鷚龣鹲鹯鶙鹉龢鶙鹉id龣router

鸩龣Drupal\Core\Routing\AccessAwareRouter

龎鵜鶙鹉鸼鸥鸡龣checkAccess(Request $request);鼷龗鼚鹶黒黏鹆鹅龢鼚鵙黭齪鹯鹪鹦黪鷚鶝麒黠黒黏齪鷟鷜麄鵖齖鷇鷃鵒齚鹪鹦黪鷚鶝鵭鹳龢鵏鶥龣

鹳鸻鵌鸻龁鵋Account

Account龁鵋鵉鵅鼯齚鹳鸻鵌鸻齪鵃鴿鼯齚鹳鸻龢齘齗鴼鴻齪黣ID齌麎鴹齌龲龮齌鴵鴴齌鼒鴰鴭鴭齪龎Drupal鸼鹳鸻鵌鸻龁鵋鵖齖鷙鷖鼕鴬鵙龣

Drupal\Core\Session\ AccountInterface

齩麖鵜鴬鵙鸼鷇鷃鷟鷜齩齨鴫鹳鴩鸵鴼鴻齪龹龵鴨鴧鴫鹳龢鵌鸻龁鵋麃龣

Drupal\Core\Session\ UserSession

鵜鵌鸻龁鵋龗龎龹龵鶹鸛kernel.request鸱鶥鼒鹯鴣鴡鶝authentication_subscriber鴜鴙齪鵜鴣鴡鶝龢鸩麃龣

Drupal\Core\EventSubscriber\AuthenticationSubscriber

龎鵜鴣鴡鶝鸼鴗鹳鴧鴕鴓鹽鴜鴙鵌鸻龁鵋齪龹龵鷙鴏鷠龠鴜鴙鵌鸻龁鵋龢鴍鴉鵉鴈鴆鴄龣

Drupal\user\Authentication\Provider\Cookie龢getUserFromSession(SessionInterface $session)鸥鸡鸼

齃鳾鴄鴧鴕鴓鹽齪鵱龢鵉鴈鴆鴄\core\lib\Drupal\Core\Authentication鸼齪鳽黙鹣黏鴡齗龹鳼鴧鴕鷱鷦龣

http://blog.csdn.net/u011474028/article/details/53064945

鴣鴡鶝鷁鴜鴙龢鵌鸻龁鵋鳞鼚鹭鶽鹳鸻鶙鹉current_user鸼齪鵜鶙鹉黣龈龣

鶙鹉id龣current_user

鸩龣Drupal\Core\Session\AccountProxy

鳛鳙鸥鸡龣\Drupal::currentUser();麬齲$this->container->get('current_user');

齨鼾鳎麈龎鴨鴧鷙鷖鸼齩齨鳊鷡麃龹龵麄麖鼍鳆session鸼鳙鹛鹳鸻ID齪麵鹛鳃鼈鳁黏鲾鹳鸻鳃鼈齃鴫鹳鹛黭麂鲺鳃鼈鵅users_field_data鲶user__roles鼺齪鼉鼈黏鲾鹛龢鴼鴻鴜鴙鹳鸻鵌鸻龁鵋齪鷠麹鷁鹖齚龁鵋鳞鼚鹭鶽鹳鸻鶙鹉鼣鼠齪龎龹龵麹鲵麉麈鸼鼷齩齨鴫鹳鵜鶙鹉鲳鹛鹭鶽鹳鸻鵌鸻龁鵋黭

齩齨齤齣鲯齚鳎麈龗齘鴄鼍鳆session鸼龢鹳鸻ID龢齪鼍鳆鳃鼈鲭鲪龎鶙鹉鶝鸼齪鵖齖齟鼯齚鼍鳆ID鼃鲧鹛鵱齪齖鵜鹳鸻ID鲤鷙鲠鸡鵖齖齟鼯齚鲤鷙鲠鸡龢sessionID齪session鹓鹒OSI鲞鲚鴓鲘龢鼍鳆鲔齪鵱鷸鲒黭http鲎鲌鲈鲇鲄鹦鷦齪麃龁鲃鹳鸻鴙黆鼯齚鱿龢鱼黀鱸鱼ID齪齨鱴SESSIONID=鱬鱨龢鱧鱣齪龎drupal鸼鲤鷙龢鱸鱼黣龈龣

SESS30c25d0f8ffe1bbe9ef7049663638486=FwIiZPyPVQcAvpsvJD_1pVNKj62m2k5w3em19oWi5wg

鵜鴼鴻齨cookie龢鸥鱣鲭鲪龎鱏鸻鲃鱌鱈鶝鸼齪鹪鹦龢鼒鱇鼍鶿鶙鹉鶝鸛鱄鵜鴼鴻齪鷒鳎鹖齚鱃鱂鱁鷟鷜齩齨齤齣鵱龂鵅鹘龢鳃鱬麁黄齪鹖龗鼯齚鰿鼻鳃鱬齪鰽鰻鷒鳎鰺鰹龢鸥鱣鰷鹳鰶鰳鵒鰯龗齮齩龂龢齪鵜鼍鳆id鹯鶙鹉鶝鴙黆黪鷚齪齗鰬鼾鼷龗鰫鰨鱏鸻鲃鰤鶙鹉鶝龢鰢鰡鰞鴕齪鷕齨鵜鼍鳆ID黣黡齊鰚齜鸥鰖鳙齪黍齴鰚齜鸥麊鼷齩齨鰷鹳鹳鸻鰶鰳鲶鶙鹉鶝鷒鰕黭麰

黣黡龎cookie鸼齮龂鵃鴿鲠鸡齟鰓龢session ID龹龵齮鼍鱧黆鼍鳆鳃鼈齪麊鼷齮鼍齟齨鼾鱧黆鹳鸻鵌鸻龁鵋龢鳎麈齪黶黵齟黭鵌鸻龁鵋鼷鴧麃鹳鸻齩鴼齪齩齨鼉鼈鵱鵃鴿龢鴼鴻鼗龓龏龎龹龵鸼鴩鸵鰒齏齩齨麒黠鴩鸵齮齩齨齪龓龏鹆鹅鼷龗鹪鹦黪鷚龢鸱龋黭麰

齟黭鹳鸻鵌鸻龁鵋龗鸸鰎鰍鰌鰊鷎鰉鰆鰂齮鼯鰁齪龎鴨鴧鷙鷖鸼鼯鰁鼍齟鼯齚鵌鸻龁鵋齪龁鵋鸼龢uid麃0鵅鹐鯽鯹鹳鸻齪鯸鹭鴄鹪鱏鷈鴄鯶鰉鰆鲇鲄齪黣黡uid麁鴄0齪鵅鹐鹪鱏鰊鷎鰉鰆黭齪鷕齨鯵齟鵌鸻龁鵋鲪龎鯱uid麁鴄0鯰鵅鹐鰊鷎鰉鰆齪龂鸸鼳鯮鯭鼯鯫龎鸖齟鰉鰆鼒齪鯩鼠麊龂鯥鹐齣鹳鸻鯹鯣鰂鯟鳊鯛齪龭麴鼯齚鲭鲪鹳鸻鯹龢cookie齪鯗鯔鶝鳛鳙鷵齩齪鹖鼣鵖齖鳞鰎龎cookie鼣鼠鯐鯏龭麴uid鼗鰉鰆龗鸖齟鹳龢齪龹龵鴫鹳龢龗session鼣鼠龢uid鯍齮龗cookie鼣鼠龢齪龂鰷鯌鰉鰆鯵齟龎cookie鼣鼠鵃鴿鯉鯆龢鼍鳆id齪鼾鼻鰊鷎鯅黭鼍鳆id鵒鰯齮齩龂鰺齣鼃麰

黒黏鷼黡鵅鹐AccessResult

龲龮黒黏龹龵龢龘龢鼷龗齖鯄齣鼯齚鯀鼈齪鮼龹龵鼉鼈鹖齚鯀鼈鼗鼂黾齲黲黰龍鸵麒黠齪鹖齚鯀鼈龎drupal鸼齁齻AccessResult齪齩鮻鮸麃鹪鹦鯗鯔黒黏鷼黡齪齲龲鯗鰞鼈齪龎龹龵鸼齨黣龈鮴鵋鸩鼃鵅鹐龣

Drupal\Core\Access\AccessResult

鷟鷜鼃齤鼯齤鹖齚龲鯗鰞鼈鼸鵜黧鮰齸齴鮬鮪龣

龎鼜黠龲龮黒黏鼒齪鲳鹛鹖齚龲鯗鰞鼈龗鵖齖龩鮧龢齪黣黡麷齚鹪鹦鮤鼗龩鮧黍齴龹龵鮪龂鼍龈鮡齪鷕齨鵖齖鷁鹖齚鰞鼈鮟鲪鮝鼃齪齩龗黣黡鼜黠鮟鲪黍齴龎龲龮鮜麴鮘鮖鼒鮕齴鮒鯣鰂齮鹳鮎鴉齪鹖鸵鹦鷦黷鷙鰊鷎齊鮟鲪齜齖齕齃鼾龈鼻齌鱸鮋齌齩鮟鲪鼒鼤鼺鯄鷸鲒黭齪鷕齨鮟鲪龗齩黠龢鯍鯱龗鸄齖龢齪黍齴鹯鼕齩鮈龲鯗鰞鼈鵖齖黧鮰齩鮟鲪鮪齪龎drupal鸼鼷黦鷖龎鵱鵖齖鷙鷖齩鮟鲪鯀鮄鴬鵙CacheableDependencyInterface齪鹖龗鵱龢鰚鼯齚鮬鮃龣齩鮟鲪鮬鮃麰

龁鼯齚龲龮龢黒黏齪鯵齩龂齻齣齜鹂鲒鮀龣魾鯆鼂黾齌魾鯆魻魸齌鲶魶魵鲈鳾齲鲈鸡龓龏鯍黺魱黒黏鲭魯鸼魮齪黍齴龲鯗鰞鼈鼷龁鼸齜鹂鲇鲄龣鼂黾Allowed齌魻魸Forbidden齌鸼魮Neutral齪鹖龗鵱龢鰚魬齚鮬鮃龣鲇鲄鮬鮃齪龎drupal龹龵鸼鷙鷖黭齜齚鸩鼃黉黀鵅鹐鹖齜鹂鲇鲄龣

Drupal\Core\Access\AccessResultAllowed龣鼂黾

Drupal\Core\Access\ AccessResultForbidden龣魻魸

Drupal\Core\Access\ AccessResultNeutral龣鸼魮

鵱鷜鮤魪魩魶鮴鵋魨鸩龣

Drupal\Core\Access\AccessResult

鷙鴏鸼鼯魧龲龮黒黏齩龂鷎鳎鸫齚鳾魦齃鼯齚鳾魦龁鼸鼯齚黒黏鶝齪鮈麹鼻鼺齪麷齚鳾魦鮤鼍鯄齣鼯齚龲鯗鰞鼈齪魣鷟鷜鯵鳾鴉鷠龠鷼黡齪麊鼷龗鯵鵖齖鼯齚龲鯗鰞鼈鼃齻鲒鰁齪黍齴鼷鵖齖鷁麷齚鳾魦龢龲鯗鰞鼈鼜黠鲠鸙齪鷠龠鯵鲳鹛鼯齚齪黍齴鮕齴鲠鸙鯣鰂鹖龗齖魢鹌鹉魡龉鯍鰁龢齪鷒魟齟齨龈鵒鹂龋鼄龣鯵齖齟鼯齚鼂黾鼷鼂黾齌鯵齖齟鼯齚齮鼂黾鼷齮鼂黾齌鸼魮齩魢麃鼂黾齲齮鼂黾齪黜黚魞魛龢鲠鸙齓齏齩齨鴫鹳鹆鹅齓齏鱂鼜黠魙鹂鵏鲠魕黆齪鹯鴄鹌鹉魡龉龢鸫鯫鮪龹龵齮齩龂魓麄鰁魏齣鷕齟龢鲠鸙齓齏齪魣魍齩齨鰁魏鷠魟鮈龢鲠鸙齪鮈龈麰

龹龵齏麃鼯齚鲯黦龗鹼魉龢齪黵鷕齨齖鼜黠龲龮黒黏麊鼷魅鹐鰌鴨鴧鰊鷁魂鸭魢齏齮魀鬽龢齪鹖麊鱂鲠魶麼鬺鬶齪鼷鼶鸍鼯齚鴙齾鲭魯鼫鬳鴉齩鬲鬱鬭鹛鬬鬫齪黣黡齸齴麊齮鬪鬨鬥龢齨麃鹖齚鸮鸭龗鬤鰎龢黍齴鵱齩龂鼷鬢齮龈鼗齪鷕齨鼷鴜鴙黭鷠魟鮈龢龲鯗鰞鼈鲠鸙鬺鬞齪龹龵鴨鴧鵃鴿黭鹖鹂鬺鬞龢鷙鷖龣

1龣鯵齖齟鼯齚魻魸黍齴鷼黡鼷魻魸齪鼷鼶鸍龍鳾魦麈鹀龎鯅龣鬜鰽黺鵱鼜鼃鷟鷕鲭鬛龢鹼鹸鼷鼍鬭鹛鬗鬔齪黍齴龹龵鼷鼸鵜黲黰齪魻魸龢鬑麄鬍龗鷠鬌龢齪鵱齟鬊鬉鮪齪齮黪齸齴鰤鵱鲠鸙鷼黡鮤麃魻魸麰

2龣鮤麃鼂黾鷵鼂黾麰

3龣鸼魮鲶魻魸鲠鸙鶽鼠鰊鷎鯅黭麃魻魸齪魣鲶鼂黾鲠鸙:黉麂鹂龋鼄龣鷼黡鼂黾齃鬆鬂黒黏鼺齌鷼黡鹏龗鸼魮齃鸓鸑黒黏鼺

鹖鼣鵖齖鳞鰎龣鸫齚龲鯗鰞鼈龢鲠鸙鲶鯵齟麂齚龲鯗鰞鼈龢鲠鸙鬺鬞龗鸖齟鴰黀龢齪龂鲠鸙麂齚鼷龂髿鸉鹛鲠鸙鸫齚齪麃黭鳊鯛鮝鮈齨麂齚齏麃髽髺龁鵋麰

鼉鼈鼾鼠鸼魮鲠鸙龢麂鹂龋鼄龹龵鰁魏黭麂齚鲠鸙鸥鸡龣

麃鴫鹳鸥髶鮝鮈鵱鷜龎龲鯗鰞鼈龢鮴鵋魨鸩Drupal\Core\Access\AccessResult鸼鷙鷖齪鮈黣龈龣

andIf(AccessResultInterface $other)龣鸓鸑鲠鸙黒黏齪鬺鬞黣龈龣

鲠鸙龢麂鸥鯵齖黷鸼鼯鸥龗魻魸齪鷼黡麃魻魸

龎鸖齟魻魸龋鼄龈齪鯵齖齟鼯鸥麃鸼魮齪鷼黡麃鸼魮

麂齚鮤龗鼂黾鷼黡鯰麃鼂黾

齩鹳龈鵅鼃鵅鹐龣

|A N F

--+-----

A |A N F

N |N N F

F |F F F

orIf(AccessResultInterface $other)龣鬆鬂黒黏鲠鸙齪鬺鬞黣龈龣

鲠鸙龢麂鸥鯵齖黷鸼鼯鸥龗魻魸齪鷼黡麃魻魸

龎鸖齟魻魸龋鼄龈齪鯵齖齟鼯鸥麃鼂黾齪鷼黡麃鼂黾

麂齚鮤龗鸼魮鷼黡麃鸼魮

齩鹳龈鵅鼃鵅鹐龣

|A N F

--+-----

A |A A F

N |A N F

F |F F F

鸓鸑黒黏鲶鬆鬂黒黏鴰黀龎鼂黾鲶鸼魮鲠鸙鼒龢鷼黡鼾齪鯍魻魸龢鷈鷚鷼黡龗鯸麾龢齪魻魸黧鮰鬊鬉鮪齪麊鼷龗鯅鯵齖齟鼯齚黲黰黍齴齮黪鸫鬱齚鲠鸙齪鷼黡鼷龗鬽黃黲黰麰

鹖麂齚鲠鸙鸥鸡龎龹龵鸼鸫鷈鴫鹳齪鸍黣鷙黦黒黏齌鱃髰鹪鹦黒黏鴭鴭麰齨鼾鯵龗髮鷜鲇鲄龢鲠鸙齪龲鯗鰞鼈龗齩鮟鲪龢齪黍齴龎鹖鹂鲠鸙鹆鹅龈髮鷜龢齩鮟鲪髫鮪鮕齴鲠鸙鯣龣

髨麄鵖齖魾髥鮟鲪髫鮪鵉鵅龢龗龲鯗鰞鼈龎鮟鲪鸼龢髡魸髠鶥齪髡魸麊鼷龗鮟鲪髞鰓髚鮝髗髖龩鮧龲鯗鰞鼈麰黷髓鲠鸙龗鸖齟鸥鶿鮪龢齪麊鼷龗鯅鲠鸙A齌B齌C齜齚龲鯗鰞鼈齪麖A鸞髑鲠鸙鲶麖C鸞髑鲠鸙齪鷼黡鼸鵜鼯鯫齪魣麃黭鮟鲪鬑鮖齪鼂黾齮鼯鯫齪鯵齖鲭鴕龲龮黒黏鷼黡鯉鯆鷵齩麰鯵齖髏髋黭麂齚龲鯗鰞鼈龢鲠鸙龋鼄鼷龂髿鸉鹛鸫齚齪鹖鼣齨A齌B鲠鸙麃C麃鳼髉鼃鯅魾齪龈鼠鷟鷜齤鼯龈andIf麬鲶orIf鹖麂鹂鲠鸙龢龋鼄龣

andIf龣

鷼黡麃魻魸龢龋鼄龣

AB黷鸼鼯鸥魻魸龗鷼黡C麃魻魸龢鯌齖髠鶥齪黍齴鯵鵖齖鼯齚魻魸龢鮟鲪髫鮪鸙鼚C鷵齩鲭鴕魻魸鷼黡龢齟鰓鮪齪齮黪髇鼯齚龗齸齴鲇鲄齪鸙鼚齮龗鸄鵖龢齪黣黡鸙鼚麊齮鼍髅髄髂鯆鮪齪魣鮟鲪鮪龂鮡骿齪骽麃鸙鼚麹髚鮝鮟鲪髞鰓龢骽齕骹黚齪鯵齖齊鸙鼚龢黍齚魻魸龢鮟鲪髫鮪齮鮘鼷龂鲭鴕鷼黡麃魻魸齪鯍骹黚龢骽齕髚鮝龢髞鰓龗齮鸄齖龢麰齘鴄鹖鼯骷髇魂鼯鸥齮鼸鵜齊鸙鼚齪鷕齨A+B鲶B+A龢鷼黡齩齨齮鯸麾齪鹖龗鬑鮖龢鷼黡麰

鷼黡麃鼂黾龢龋鼄龣

鹖鹂龋鼄龈AB骵鸄骳麃鼂黾齪鯵齖髮鷜鸼骰鶾鼯齚鮟鲪髫鮪齟鮘鮖鮤齩龂髚鮝鷼黡鮘鮖齪鷕齨髮鷜龢鮟鲪髫鮪鮤鸄骳齖鸙鼚鷼黡鸼齪MaxAge齨黄龢麃髂

鷼黡麃鸼魮龢龋鼄龣AB骰鶾鼯齚龢鮟鲪髫鮪鮘鮖鮤齩龂骬骩鮘麃魻魸齪鯍骬骩C龢鮟鲪髞鰓齪鷕齨鮤鼸鵜鸙鼚

orIf龣

鷼黡麃魻魸龢龋鼄龣鲶andIf龋鼄鯸麾

鷼黡麃鼂黾龢龋鼄龣AB鯵齖齟鼯齚鮘麃魻魸齪黍齴鼷鼍髚鮝鮟鲪髞鰓齪鷕齨鵱鷜龢鮟鲪髫鮪鼸鹭鮤鸙鼚鷼黡

鷼黡麃鸼魮龢龋鼄龣麾鼂黾龋鼄鼯鯫

齩齤齣andif鲶orif龢鮟鲪鲠鸙鷈鷚龗鯸麾龢麰

龎orIf龢鴨鴧鷙鷖鸼齪骥鱏鸛鷖龗齟魀鬽骡骞龢齪黣龈龣

鹦鷦鼷齣龎orIf鲠鸙鸼龢鮟鲪髫鮪鲠鸙鼾鼠齪骜龭齟麂齚鰞鴕龁鵋A齌B鵱鷜鮤麃鼂黾鲇鲄龣

A龢getCacheMaxAge麃0齪B龢麃骛0齪鲠鸙鷼黡鷁齨骛0麃髂

A龢MaxAge麃0齪鵅鹐齮齩鮟鲪齪齩龂骘鼒鼤鮘鮖齪鮘麃魻魸鼒齪龎鮟鲪鸼龢鲠鸙鷼黡龎B龢MaxAg骕骑鹼龗齟鰓龢齪鷕齨龎B齮骍验鼒骈麼麃鼂黾齪魣鷙鴏鼾A鰊鷎鮘麃魻魸黭麰

龎鹳鸻鴫鹳鲔鼠黦鷖龎鰊鷎鳎验龢鰫龲鹏鼍魪鲵齟鰓

鵜魀鬽bug骥鱏鰊鷎鶿骆鸥鵃鰢

鹪鹦黪鷚access_manager

鹪鹦黪鷚鶝龗龹龵麒黠鼚鹶黒黏龢骃鲠黪鷚齱齪鵃鴿鯄龹龵鼯齚鴫鹳龲龮黒黏API龢鼚鵙龣

鶙鹉id: access_manager

鸩龣Drupal\Core\Access\AccessManager

鳛鳙鸥鸡龣\Drupal:: accessManager ();麬齲$this->container->get('access_manager');

鴫鹳鵱麒黠龁鹣鹟龢黒黏龣

$access_result = \Drupal:: accessManager ()->checkRequest($request, $account, TRUE);

$access_result->isAllowed(); //驻驷bool齪鵅魾龗鸸魾鯆鼂黾齪鸼魮鮧齮鼂黾

鹪鹦黪鷚鶝鷙鷖黭齨龈鴬鵙龣

Drupal\Core\Access\ AccessManagerInterface

鵜鴬鵙鸼齟齜齚鸥鸡齪鴍鴉龗check鸥鸡齪黷髮麂齚鯵龗髶鴄鷟鷜鴫鹳齪鵱鷜鷠龠鴫鹳黭check鸥鸡

check鸥鸡龢鮋鯹黣龈龣

check(RouteMatchInterface $route_match, AccountInterface $account = NULL, Request $request = NULL, $return_as_object = FALSE);

鰚鼯齚驴鳃麃鹲鹯驳鮜鶝齪鵱龗鼯齚鹪鹦鹣鹟龢鹲鹯鴼鴻鵅鹐齪鼚鹶龲龮黒黏龗齏鹳龎鹲鹯鴼鴻鼾鼠龢齪鹲鹯鴼鴻鼷鼳鼯鷃鼏齪鼨鼤鼣龗鷟鷜鰻齖鲭鬛龢鹼鹸齪龲龮黒黏鼷鼳鼫鼩

鷠麹鼯齚驴鳃$return_as_object黣黡麃true鬞驻驷龲鯗鰞鼈龁鵋齪黣黡龗false鼷驻驷龲鯗鰞鼈龁鵋龢isAllowed()鸥鸡鷼黡齪鹖鰎鰍鰌鸼魮龢龲鯗鰞鼈鷁齊魢麃魻魸齪骽麃鸼魮龢龲鯗鰞鼈龁鵋龢isAllowed()鸥鸡鷁驻驷false齪鷕齨鹭鷟鷜鵖齖黜鳽驱鴼鴻鼒鼸鹭驻驷龁鵋麰

麃齸齴鯅鹪鹦黪鷚鶝龗骃鲠黪鷚齱鯣鰂鹖龗骽麃鵱齗鰶鷕齻鸱龋龗鸍驰鬱龢齪龎鹼黃鵱鴫鹳黒黏鵃鴿鶝CheckProvider鵃鴿龢鸫齚黒黏鶝check鼃麒黠黒黏齪麷齚黒黏鶝鮤驻驷鼯齚龲鯗鰞鼈AccessResult齪鹪鹦黪鷚鶝齗鰶鯵鼜黠龲鯗鰞鼈龢鲠鸙齪鹖鹂鲠鸙驭鹳鸓鸑鲠鸙黒黏齪麊鼷龗andIf鲠鸙齪鷠龠鶿鴫鹳齱鵃鴿鼯齚驩鼯龢龲鯗鰞鼈齪鷙鷖鸼鵜鰞鼈鼍齊鲭鲪鹛鹣鹟龁鵋龢髫鮪驧鸼齪黣龈龣

$request->attributes->set(AccessAwareRouterInterface::ACCESS_RESULT, $access_result);

齩齨鷒鳎$request->attributes->get("_access_result");鳛鳙

龎驣驢黒黏鵃鴿鶝鲶黒黏鶝黵鶽鷟鷜鵖齖麄鴧鱼鼯龈驴鳃鷸驟鶝麰

驴鳃鷸驟鶝ArgumentsResolver

黒黏鶝check鷙鴏鼾龗鼯齚驷鵭齪鵱鵖齖鼯鸵驴鳃鼃鼜黠龲龮龓龏齪鹖鸵驴鳃驧驜龣鹲鹯龁鵋齌鯶鷎驘驖龢驔髑鹲驑鮘驐齌鷎鳎驴鳃驘驖麹龢鹲驑鮘驐龁鵋齌鰁魏鹲鹯鼒鹲驑驴鳃龢鴨鴧鱬齌鹲鹯鸼鵃鴿龢驌魂鮘驐齌鹲鹯驳鮜鶝龁鵋齌鵌鸻龁鵋齌鹣鹟龁鵋齪魣黒黏鶝驉驉鯵鵖齖鹖鸵驴鳃鸼龢鼯黃黉鯍鰊齪鸍黣齟鸵黒黏鶝鼷齮鵖齖鹣鹟龁鵋齪黒黏鶝鷁鵖齖龢驴鳃鰁魏龎黒黏鸥鸡龢鮋鯹鸼齪黍齴龹龵龎鵭鹳黒鰹鶝驷鵭鼒鮕齴鷇鷃鼸鵜鬊驈鴩鸵驴鳃鯣鰂麃黭鷸鲒鹖齚鹦鷦龹龵鸼鰁魏黭驴鳃鷸驟鶝ArgumentsResolver麰

鷙鷖鸼驭鹳驴鳃鷸驟鶝驇驆鼃鴙黆驴鳃鷸驟鶝齪驇驆龢齏鹳龗魓麄鷁鹖鸵驴鳃鬽黃鬊驈鯄鷵鷁齖鴫鹳龢驴鳃鷸驟鶝齪驇驆龗鹸鶝鸼龢鼯齚鶙鹉齪id龗龣access_arguments_resolver_factory

鸩龣Drupal\Core\Access\AccessArgumentsResolverFactory

鵱驻驷龢驴鳃鷸驟鶝龁鵋龢鸩鰁魏麃龣

Drupal\Component\Utility\ArgumentsResolver

鵜驴鳃鷸驟鶝鴗鹳php龢黶驅驃鯔龓龏黒黏鶝驷鵭鴫鹳齸齴驴鳃齪鹖鼂黾黒黏鶝驷鵭鴗鹳驴鳃鸩鲘魅鹐齲齱驴鳃鯹鼃鹑鰁魶魵鵖齖龢驴鳃齪黷髮驴鳃鷁齮齊鬊鼚齪龎騿騽齨鼾鵃鹛龢黍鸵驴鳃鼒齪齟鼯齚鬑麄騼鹀齪龎騸騷鸩鲘魅鹐齲驴鳃鯹鯸麾龢龋鼄龈齪鬑麄鬍鯀髓黣龈齪1麃鷠鬌鬑麄龣

1鷎鳎驴鳃驘驖麹龢鹲驑鮘驐龁鵋

2鹲鹯龁鵋齌鹲鹯驳鮜鶝齌鵌鸻龁鵋齌鹣鹟龁鵋

3鯶鷎驘驖龢驔髑鹲驑鮘驐

4黒黏鶝驷鵭齗鰶鰁魏鼒驴鳃龢鴨鴧鱬

鳽鮈龣Drupal\Component\Utility\ArgumentsResolver:: getArgument(\ReflectionParameter $parameter);

黒黏鶝Check

龎鹪鹦黪鷚鶝鸼鰊鷎鷩鹛黭鷙鴏龢黒黏龗鹯黒黏鵃鴿鶝CheckProvider鵃鴿龢黒黏鶝check鼃鼜黠龢齪麷齚黒黏鶝鮤鼶鸍鼯鴆鼫鼩齪鷙鴏鼾黒黏鷎魟齮魸鼯齚鼫鼩齪齩龂齟黾鸫齚齪髮鷜魙魶黒黏鼯魧鹼鹸齪龎龹龵鸼麷鼯齚鵖齖鳾鳞齊黒黏龲龮龢鴓鹽鮤齩齨鶹齣鼯齚鼫鼩齪鹖鸵鼫鼩鹯黒黏鵃鴿鶝龵鼯黪鷚齪黒黏鵃鴿鶝鼷鼶鸍鼯齚魀鲭騳騰鯍齮龗鯛齚黧黦龢鼫鼩騬騩麰麃騥鷡鸥髶麹鼻鷟鷜龵鼯鴫鹳鯹騤龣CheckProvider黒黏鵃鴿鶝齌Check黒黏鶝麰

龎drupal8鸼鷕齟龢黒黏鶝鮤鵖齖鷙鷖鵜鴬鵙龣

Drupal\Core\Routing\Access\AccessInterface

黒黏鶝齗鰬鼾龗鼯齚驷鵭齪龎驴鳃鷸驟鶝鼯鷣鰊鷎鷩魾鵱齩齨鴬鬭齮麾龢驴鳃齪鷕齨鸙齮鲪龎鼯齚鯸麾龢龁魂鴬鵙齪鷕齨鵜鴬鵙齊龭龩麃騡鴬鵙齪鯵龗鮝鹛鼯齚鱸騝鯍鰊齪龎drupal9鸼鵱鷁齊騙騗齪鳾鴄鹖骷骆鸥鰊鷎齻黭鯅魾龣

鹣鮈龣 https://www.drupal.org/node/2266817

龘鶽龎drupal8鸼鷕齟黒黏鶝鰁魏鯀麼鵖齖鷙鷖鵜鴬鵙齪龹龵鸼鴨鴧鰁魏黭魬騕鸫齚黒黏鶝齪黣鵖黏齤鹣鷭齗龹鳼鯀鮄鳞鼚鷱鷦鼣鼠鵃鴿龢鸥鸡骬齣鹸鶝鰁魏鼻鶥齪黏齤騑齟鶙鹉龣access_manager.check_provider鷵齩齪龈鼠騐鹐黷鸼黧黦龢鼯齚黒黏鶝龣

Array

(

[0] => access_check.csrf

[1] => access

[2] => Array([0] => _csrf_token)

[3] => 1

)

鼯齚黒黏鶝齟騊魧鳃鼈齪龁鼸鼾鼠龢騇髉鯀髓麃龣黒黏鶝龎鹸鶝鸼龢鶙鹉id齌麒黠黒黏龢鸥鸡鯹齌黒黏鱸鱼齃齮魾髥鸖鳾龹齪鮈龈鼻鼺齌齗黒黏鶝龗鸸鵖齖鹪鹦鹣鹟龁鵋麰

鼃齤鼯龈鴓鹽黣鶾魶鰁魏黒黏鶝鼷魾髥鹖騊魧鳃鼈鵉鵅龢鰎騅黭齪龎D8龹龵鸼鷕齟龢黒黏鶝鮤龗鹸鶝鸼龢鶙鹉齪鷕齨鷟鷜鵖齖齨鰁魏鶙鹉龢鸥鱣鼗鰁魏黒黏鶝齪黣鶾鼜黠鶙鹉鰁魏鹣齤齗龹鳼鯸鳾鷱鷦齪龎鼕齮麵黙鷡齪鯱黒黏鶝鶙鹉骵鵖齖鷙鷖鶽鼻鵃鹛龢Drupal\Core\Routing\Access\AccessInterface鴬鵙齪鹖鼣騐鹐鼯齚鰁魏騇髉龣齃鮈騄騀鹼鹸鴰鼺

鷭駿鷠駻鷙駹齪鶙鹉鯹齨access_check.齏麃鶽駶齪鸩鯹齨AccessCheck齏麃麹駶齪魣齮龗駳鯔龢

鸄骳鯄齣鱴access_check鱨鱸鮋鯹齪鱸鮋鼣鼠黷髮驴鳃龗齩騽龢齪method鵅鹐鵭鹳齗黒黏鶙鹉鼒麒黠龢鸥鸡鯹齪駲駯鼒鴨鴧麃access齪needs_incoming_request鵉鵅齗黒黏龗鸸鵖齖鹣鹟龁鵋

access_check.yunke:
    class: Drupal\moduleName\Access\YunkeAccessCheck
    tags:
      - { name: access_check, applies_to: _csrf_token, method: access, needs_incoming_request: TRUE }   

applies_to騽魧龢鱬鼷龗鼾鼻鵃鹛龢黒黏鱸鱼齪鵅鹐黣黡龎鹲鹯鰁魏鼒requirements魧鸼驧駫黭齗騽魧鰁魏龢黒黏鱸鱼髉魧齪黍齴鵜鹲鹯鵖齖鼜黠齗黒黏齪鸍黣黣龈鹲鹯鰁魏龣齃鮈騄騀鹼鹸鴰鼺

龎鵜鹲鹯鰁魏鸼requirements魧齟鼯齚_csrf_token髉魧齪黍齴龁鼕鹲鹯龢黒黏鷁駨鹳龹龵鸼鷕齟黧鮰applies_to: _csrf_token鰁魏龢黒黏鶝齪鯍齮黪_csrf_token髉魧龢鱬黣鶾齪鵱龢鱬驉驉鷁鬊驈鯄黒黏鶝駥

comment.approve:
  path: '/comment/{comment}/approve'
  defaults:
    _title: 'Approve'
    _controller: '\Drupal\comment\Controller\CommentController::commentApprove'
    entity_type: 'comment'
  requirements:
    _entity_access: 'comment.approve'
    _csrf_token: 'TRUE'
    comment: \d+

鷟鷜鰁魏鹲鹯鼒魟鹳龢駡駝魧_permission鼷龗applies_to龢鼯鹂鱬齪駨鹳鵜駡駝龢鹲鹯鼍鴫鹳齨龈黒黏鶝龣齃鮈騄騀鹼鹸鴰鼺

鹖齚黒黏鶝鶙鹉鹯鹳鸻鴓鹽user鰁魏齪鵱鷁駨鹳鹛鷕齟鹑鰁黭_permission駡駝龢鹲鹯

access_check.permission:
    class: Drupal\user\Access\PermissionAccessCheck
    tags:
      - { name: access_check, applies_to: _permission }

黒黏鶝龢applies_to騽魧龢鱬麃黭騥鷡鳊鯛齪骥鱏鷁黷駛麃黒黏鱸鱼齃鵱龗鹲鹯鰁魏鸼駡駝魧鳃鵏龢駘鯹齪齮龗駘鱬齪駡駝鳃鵏騗黒黏鱸鱼魧魂鹏驧驜黷髮鹼鹸鼺齪applies_to騽魧齩齨鹑鰁鸫齚鱬齪麊鼷龗齩齨鹑鰁鸫齚黒黏鱸鱼齪齖鹑鰁鸫齚黒黏鱸鱼鹑鰁鸫髠tags髫鮪鷵齩齪黣鼾鼠龢騇髉鹑鰁鸫齚黒黏鱸鱼鷁黣龈鰁魏龣齃鮈騄騀鹼鹸鴰鼺

method鲶needs_incoming_request齨鷠麹鼯髠麃髂齪鹖鯫鼷鹑鰁黭麂齚黒黏鱸鱼齪鵜龭龩黷鷙齩鮧龗鼯齚bug齪魣drupal8龘鶽鼷龗黣鼕齪鰽鬜鰻鴫鹳齨龈鰁魏鷁齣駖龣

- { name: access_check, applies_to: [_csrf_token ,_permission], method: access, needs_incoming_request: TRUE }

鹖龗駌駋黒黏鶝龢駈鮸鶝駄黆龢齪麹鼻鷁鼍鵃鹛

access_check.yunke:
    class: Drupal\moduleName\Access\YunkeAccessCheck
    tags:
      - { name: access_check, applies_to: _csrf_token, method: access, needs_incoming_request: TRUE }
      - { name: access_check, applies_to: _permission, method: access, needs_incoming_request: TRUE }

黒黏鱸鱼龗駃龹黒黏鶝鲶鹲鹯龢駂馾齪齩齨魶鰁魏齪鼯黮鰁魏麹齪龎鹲鹯鰁魏鸼鹑鰁鵱齏麃requirements駘龢髉駘鼷齩齨鴫鹳鵜黒黏鱸鱼龁鼸龢黒黏鶝黭齃齮黪鵜髉駘龢鱬麃鶾骵鼍鴫鹳鼺駥黒黏鱸鱼魧龢鱬鲭鲪龎鹲鹯龁鵋鸼齪龎黒黏鶝鼣鼠齩齨鳛鳙鹛齪黒黏鱸鱼齮龂鲶龹龵鸼鰊鰁魏龢鯸馺馸齪龹龵鸼鰊鷎鴨鴧鰁魏黭齨龈黒黏鱸鱼龣

_access

_entity_access

_entity_create_access

_entity_create_any_access

_access_theme

_custom_access

_csrf_token

_access_contact_personal_tab

_field_ui_view_mode_access

_field_ui_form_mode_access

_access_node_revision

_node_add_access

_node_preview_access

_access_quickedit_entity_field

_access_system_cron

_access_system_update

_access_update_manager

_permission

_access_user_register

_role

_user_is_logged_in

髮鷜鷒魟齨龈馵馱齏麃鶽駶齪魣鹖齮龗鸄骳龢齪鯵齏麃鷠駻鷙駹齪髿馯齨龈馵馱鸞髑齪黒黏鱸鱼龗龎鰁魏黒黏鶝鼒龎applies_to鸼鰁魏龢齪鼯齚黒黏鶝齩齨鰁魏鸫齚黒黏鱸鱼齪鸥鸡鮈鼾齪魣麃黭龭龩鼾馮龂黉馬黒黏鶝驉驉鯵鰁魏鼯齚黒黏鱸鱼麰麷齚鹲鹯鰁魏麊齩齨鹑鰁齃鳞鰎齮龗鰁魏鼺鸫齚黒黏鱸鱼齪魣馩鬱齟鼯齚黒黏鱸鱼齃鹑鰁_access_checks鱬龢龋鼄騗魂齪鮈龈鼺齪鸸鬞鼷鼍齣鷖鸖齟黒黏鶝齪鹖鹂龋鼄龈龹龵龓鰁麃黲黰鹪鹦齪鷕齨鷒魟鷟鷜鮤鼍鴫鹳_permission黒黏鱸鱼齪鵱龢鱬龗鹭鶽鹳鸻鵖齖黧鮰龢龲龮齪龁鼸龢黒黏鶝龗鶙鹉龣access_check.permission

騗黭駨鹳黒黏鱸鱼鷁黒黏鶝鲶鹲鹯駃龹鮝鼃魂齪黒黏鶝鹏齟髇魂鼯鹂鸥鸡鼃齻鹛鹖鼯骷齪鵜鸥鸡齮鵖齖龎黒黏鶝龢鶙鹉鰁魏鸼鹑鰁黒黏鱸鱼齪黒黏鶝鯵鵖齖鷙鷖Drupal\Core\Access\ AccessCheckInterface鴬鵙鷵齩齪鵜鴬鵙鯵齟鼯齚鸥鸡龣

applies(Route $route);

鵱驻驷bool鱬齨鵅魾馥龁龍鹲鹯龗鸸鵖齖駨鹳齗黒黏鶝齪鮝鹛黭鲶黒黏鱸鱼鯸麾龢齏鹳齪魣馤鬢駳麁黾鸫麰

黒黏鵃鴿鶝CheckProvider

龹龵鸼鰁魏黭黾鸫黒黏鶝齪鵱鷜齊黒黏鵃鴿鶝龵鼯黪鷚齪黒黏鵃鴿鶝龗鼯齚騑齟龢鹸鶝鶙鹉齪鲈鸡麖鹸鶝鸼馡鴬get齪鵱龎core.services.yml鼻鶥鸼鰁魏龣

鶙鹉id龣access_manager.check_provider

鸩龣Drupal\Core\Access\CheckProvider

龎鹸鶝駈鮸馞髰鼍駌駋龹龵鸼鷕齟龢黒黏鶝鳞鼚鹛鵱鼣鼠齪鵜驇齏鹯齨龈駈鮸鶝魕黆龣

Drupal\Core\DependencyInjection\Compiler\RegisterAccessChecksPass

龎鹖齚駈鮸鶝鼣鼠齩齨齤齣鶽鼻鵃鹛龢鹑鰁鸫齚黒黏鱸鱼龢bug鹦鷦

黒黏鵃鴿鶝驧駫黭鷕齟龢黒黏鶝齪龎鼜黠黒黏鼒鷙騇鮖鵖齖龢黒黏鶝齪鼕魂鵱鹏鼉鼈黒黏鱸鱼齲齱鵭鹳黒黏鶝龢applies鸥鸡鼃龓龏鼯齚鹲鹯鵖齖鴫鹳鴩鸵黒黏鶝齪魣鵜驇齏齮龗龎龲龮黒黏鼒鼜黠龢齪鯍龗龎鹲鹯馛魮鼒麰

鹭鼯齚鴓鹽馘鹳鼒齪龹龵鼍黒黏龗鸸齟鹲鹯鰁魏齪黣黡齟鷁鼍駈鮸鹲鹯鸙鲭鲪鹛鳃鼈鳁齪齨麹鯵麖鳃鼈鳁黏鲧鹲鹯齪龎鵜鳎麈鸼黒黏鵃鴿鶝鼍鲧齣鵜鹲鹯鵖齖鴫鹳鴩鸵黒黏鶝齪鸙黋鹖鸵黒黏鶝龢鶙鹉id鲭鲪鹛鹲鹯options鰁魏龢_access_checks髉駘鸼齪龎齨麹龢駨黠鸼齻黒黏鼒麖鵜騽魧髉駘鳙鱬鼷鷇鷃鵖齖駨黠鴩鸵黒黏鶝黭齪鳽鮈龣

Drupal\Core\Routing\ RouteBuilder:: rebuild()

鹲鹯騽魧options髫鮪龢_access_checks髫鮪鷒魟齏麃龹龵鹼黃鴫鹳齪龎鹲鹯鰁魏鸼齟黒黏鱸鱼龢龋鼄龈鼍首馔馑鹳鸻魶魵鰁魏龢鱬齪黣鵖魶鰁魏鬞齖鲭鴕龎駡駝鸼齮齣鷖黒黏鱸鱼魧麰

龎鲭鲪鹲鹯龁鵋鼒馎黚黒黏鶝齪鹖鯫龢龭龩鼯黮龹龵髖骹黒黏鶝齪黍齴鼷齟齚鹦鷦鵖齖鷈鷚齪黣黡髖骹龢龗鴫鹳黒黏鱸鱼龢黒黏鶝鸖齸齴鹦鷦齪魣黣黡龗鴫鹳鷙鷖Drupal\Core\Access\ AccessCheckInterface鴬鵙龢黒黏鶝鯣鰂鼷鵖齖黜髖鲭鲪龢鹲鹯龁鵋黭齪鵜鹦鷦龢鷈鷚鮈鴓鹽魀馍鷱鷦麰

魟鹳黒黏鶝龣

drupal龎鱸髂魀馍龈鴨鴧鵃鴿黭魬騕魬齚黒黏鶝齪龈鼠驣驢鼯鸵魟鹳龢黒黏鶝龣

鴨鴧黒黏鶝access_check.default

鸩龣Drupal\Core\Access\DefaultAccessCheck

骛魟鳊鯛龢黒黏鶝齪龎鹲鹯鰁魏鸼鰽鸖齟鵃鴿黒黏鱸鱼齪黍齴齩齨鴫鹳鵱齻鷠鳊鯛龢龲龮鯗鯔龣

requirements:

_access: true

黒黏鱸鱼_access龢鱬龗bool,齲麃騡齪馡鴬鵉鵅鼂黾齌黲黰齌鸼魮

魶鰁魏驷鵭黒黏鶝access_check.custom

黒黏鱸鱼龣_custom_access齪鸥鸡龣access齪鲈鵖鹣鹟龁鵋

鸩龣Drupal\Core\Access\CustomAccessCheck

龎鵜黒黏鶝鸼齩齨魶鰁魏鼯齚驷鵭鼃齏麃黒黏鶝齪鹖馾鼃龜麁鸥髶齪鰁魏鸥鸡鲶鹲鹯鯗鯔鶝鸥鸡鯸麾齪魣驷鵭鵖齖驻驷黒黏鰞鼈龁鵋

鹳鸻龲龮黒黏鶝access_check.permission

黒黏鱸鱼龣麬_permission齪鸥鸡龣access齪鲈鵖鹣鹟龁鵋

鸩龣Drupal\user\Access\PermissionAccessCheck

黒黏鱸鱼龢鱬鵉鵅鹳鸻龲龮齪鵌鸻龁鵋騸騷鷵齩鼜鼚齪黶黵黲黰齪鸫齚龲龮鴫鹳黉馌鱂黉馈齪黉馌鱂鱴+鱨鵅鹐OR鳾龹齪鱴齪鱨鵅鹐AND鳾龹齪鹖麂鹂黉馌鱂齮齩鼯鮝鴫鹳齪魞魛龓龏齩齨鴫鹳魶鰁魏驷鵭黒黏鶝鼃齻麰

鼕黒黏鶝鸊鸉鹌鹉鹆鹅龲龮黒黏齪鷁龎鹌鹉鹆鹅黒黏鸼鳽鷡麰

鹳鸻鳞馄黒黏鶝access_check.user.register

黒黏鱸鱼龣麬_access_user_register齪鸥鸡龣access齪鲈鵖鹣鹟龁鵋

鸩龣Drupal\user\Access\RegisterAccessCheck

黒黏鱸鱼鱬骘鰎齪龎龹龵鸞馘鹳鸻鳞馄麹齪鹳鴄鳞馄龢鹲鹯齪鯵齟鯶鰉馁鹳鸻鯰齩齨齊鼂黾

鹳鸻麎鴹黒黏鶝access_check.user.role

黒黏鱸鱼龣麬_role齪鸥鸡龣access齪鲈鵖鹣鹟龁鵋

鸩龣Drupal\user\Access\RoleAccessCheck

黒黏鱸鱼龢鱬鵉鵅鹳鸻麎鴹齪鵌鸻龁鵋騸騷鷵齩鼜鼚齪黶黵黲黰齪鸫齚麎鴹鴫鹳黉馌鱂黉馈齪黉馌鱂鱴+鱨鵅鹐OR鳾龹齪鱴齪鱨鵅鹐AND鳾龹齪鹖麂鹂黉馌鱂齮齩鼯鮝鴫鹳齪魞魛龓龏齩齨鴫鹳魶鰁魏驷鵭黒黏鶝鼃齻麰

鰉馁鲇鲄黒黏鶝access_check.user.login_status

黒黏鱸鱼龣麬_user_is_logged_in齪鸥鸡龣access齪鲈鵖鹣鹟龁鵋

鸩龣Drupal\user\Access\LoginStatusCheck

龎鵜黒黏鱸鱼龢鱬鸼龣true齌"1", "true", "on" and "yes"鵅鹐鰊鰉馁鲇鲄齪黷髮鱬鵅鹐鯶鰉馁鲇鲄齪鯵齟鵌鸻龁鵋騸騷龭鰁龢鲇鲄鯰龂鹪鹦齪鴨鴧鷙鷖鸼鵌鸻龁鵋龢uid麃0鵅鹐鯶鰉馁齪鸸鬞鹑鰊鷎鰉馁麰

齨鼾鼷龗鼚鹶黒黏龢鬽黃鹼鹸黭齪龎龈饿黃黉鸼鷁驣驢鹌鹉鹆鹅龲龮黒黏齪麊鼷龗龎黪鷚麹饾鸼齤鹛龢鵌鸻齌龲龮齌麎鴹齨鸉鸊鸉黪鷚鹌鹉鹆鹅龢龲龮黒黏鴭鹼鹸

饼鯌鳞鰎龣

1龣麃齸齴鹭鶽鵌鸻龁鵋齖鴫鹳鼯齚鵉鷚鶙鹉鰂

龹龵鸼齩龂鵖齖鷙騇鮖鸫齚鵌鸻龁鵋齪鼕鸥鸡齩齨鱼黀鼃魶饻鴬龢鹭鶽鹳鸻齪麾鼒鵱齩齨龭麴鲶鳙齣馾鼃鯟麁馤鬢鮪

本书共83小节:

评论 (写第一个评论)