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龦鹻齲齰鹞鶺鴿鸨齸鴻齐鴕鹩鼪齗鴸鷚鶘鸻鯡

龹龸鸫齥齻鵆齐鷙駩魸鸟齗鴿鸨齸鴻齦鼒鸙鸕齥齣鱨麯黼魡饰鴖龢鹞鶺鹩鸨齦麫鼎鵦齥齣龱麞鲙鲸齞馵黼鮶鹴馜鬁鮋

本书共71小节:

评论 (写第一个评论)