在我阅读了食谱中的这一章之后
http://symfony.com/doc/current/cookbook/security/entity_provider.html
我创建了一个实现“AdvancedUserInterface”的实体“User”和一个实现“RoleInterface”的实体“Roles”。我还在“security.yml”中创建了一个角色结构。
用户和角色之间的关系是“多对多”关系。
一切安好。
对于登录用户,我可以检查这样的授权:
$this->get('security.context')->isGranted("ROLE_EDITOR");
Run Code Online (Sandbox Code Playgroud)
但是如何检查数据库中其他用户的此授权?
有像吗?
$this->get('security.context')->isGranted("ROLE_EDITOR", $user);
Run Code Online (Sandbox Code Playgroud) 我正在使用可翻译的学说,并且我有一个具有可翻译属性的实体。看起来像这样。
class Scaleitem
{
/**
* Must be defined for translating this entity
*/
use ORMBehaviors\Translatable\Translatable;
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
}
Run Code Online (Sandbox Code Playgroud)
而且我有一个文件ScaleitemTranslation:
class ScaleitemTranslation
{
use ORMBehaviors\Translatable\Translation;
/**
* @ORM\Column(type="string", length=255)
*/
protected $text;
/**
* Set text
*
* @param string $text
* @return ScaleitemTranslation
*/
public function setText($text)
{
$this->text = $text;
return $this;
}
/**
* Get text
*
* @return string
*/
public function getText()
{
return $this->text;
}
} …Run Code Online (Sandbox Code Playgroud) 我检索像这样的实体的所有对象:
$allQuestions = $em->getRepository('AppMyBundle:Question')
->findBy(array('isActive' => true, 'isDeleted' => false));
Run Code Online (Sandbox Code Playgroud)
我得到了一系列对象$allQuestions.是否有可能得到一个ArrayCollection而不是一个数组?
我看cookbook中的这一章写了一个登录程序。
http://symfony.com/doc/current/cookbook/security/form_login_setup.html
在 Firefox 中一切正常。但是在谷歌浏览器中,我登录后得到一个空白页面。在我的错误日志中存在以下几行。
[Thu Feb 19 09:26:06.502498 2015] [proxy_fcgi:error] [pid 17203:tid 140244355569408] [client 192.168.56.1:4441] Premature end of script headers: , referer: http://app.dev-local/app_dev.php/login
[Thu Feb 19 09:26:06.502888 2015] [proxy_fcgi:error] [pid 17203:tid 140244355569408] [client 192.168.56.1:4441] AH01070: Error parsing script headers, referer: http://app.dev-local/app_dev.php/login
[Thu Feb 19 09:26:06.504918 2015] [proxy_fcgi:error] [pid 17203:tid 140244355569408] [client 192.168.56.1:4441] AH01068: Got bogus version 84, referer: http://app.dev-local/app_dev.php/login
[Thu Feb 19 09:26:06.507243 2015] [proxy_fcgi:error] [pid 17203:tid 140244355569408] (22)Invalid argument: [client 192.168.56.1:4441] AH01075: Error dispatching request to : (passing …Run Code Online (Sandbox Code Playgroud) 我想在我的应用程序中打开一个whatsapp url.
let whatsAppUrl = NSURL(string: "whatsapp://send?text=Hello%2C%20World!")
if UIApplication.sharedApplication().canOpenURL(whatsAppUrl!) {
UIApplication.sharedApplication().openURL(whatsAppUrl!)
}
Run Code Online (Sandbox Code Playgroud)
我使用字典"LSApplicationQueriesSchemes"扩展我的info.plist并为whatsapp添加我的url方案.
<key>LSApplicationQueriesSchemes</key>
<dict>
<key>Item 0</key>
<string>whatsapp</string>
</dict>
Run Code Online (Sandbox Code Playgroud)
如果我运行我的应用程序,我收到以下错误消息.
"This app is not allowed to query for scheme whatsapp"
Run Code Online (Sandbox Code Playgroud)
我阅读了一些清理派生数据的解决方案并再次运行应用程序以解决此问题.但这对我没有帮助,对我的问题存在另一种解决方案吗?
我正在使用Symfony 2.3和KnpMenuBundle。
是否可以将翻译域用于菜单项?
像这样:
$menu['management']->addChild(
'msg.user.list',
array(
'route' => 'user_list',
'translation_domain' => 'navigation'
)
);
Run Code Online (Sandbox Code Playgroud) 我想为 TYPO3 后端中的每个页面分配一个图像。这个图像应该被渲染为我的 body 标签的背景图像,比如。
<body style="background-image:url("/fileadmin/user_uploads/image.png")">
Run Code Online (Sandbox Code Playgroud)
我有 TYPO3 的 6.2LTS 版本。在以前的 TYPO3 版本 (4.5) 中,我用这个排版部分实现了一个类似的解决方案
page.bodyTagCObject = COA
page.bodyTagCObject {
10 = TEXT
10.value = <body style="background-image:url(
20 = TEXT
20 {
data = levelmedia: -1 "slide"
wrap = uploads/media/ |
listNum = 0
}
30 = TEXT
30.value = );">
}
Run Code Online (Sandbox Code Playgroud)
新的 TYPO3 版本适用于文件引用,所以我不确定我如何才能意识到这个问题。
有人有提示吗?