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龤鹺齼齸鹡鶩鴷鸭龆鴶齓鴕鹪鼲齚鴲鷍鶊鸸鯰

龶龲鸮齩龇鵂齓鷉駷鮆鸟齚鴷鸭龆鴶齫鼚鸛鸗齩齨鱛麴鼋魣饪鴘龡鹡鶩鹪鸭齫麲鼗鵞齩齨龭麧鲚鲵齢馰鼋鯕鹶馛髿鮟

本书共63小节:

评论 (写第一个评论)