ckfinder 无法识别角色?
如果有人可以帮忙解决这个问题。
我正在尝试将 ckeditor 和 ckfinder 合并到 Asp.Net Mvc 1 项目中。到目前为止一切正常。我唯一无法正常工作的是 ckfinder 的访问控制。
据我了解,在文件 ckfinder/config.ascx 中,变量字符串 RoleSessionVar 用于分配要限制的角色。默认值是:
RoleSessionVar = "CKFinder_UserRole";
我的项目中有管理员、编辑者和贡献者树角色。因此,为了获取当前用户角色,我将其替换为:
string currentRole= "";
if(HttpContext.Current.User.IsInRole("Administrators"))
{
currentRole = "Administrators";
}
else
{
if (HttpContext.Current.User.IsInRole("Editors"))
currentRole = "Editors";
else
{
if (HttpContext.Current.User.IsInRole("Contributors"))
{
currentRole = "Contributors";
}
}
}
RoleSessionVar = currentRole;
为变量分配当前用户的正确角色。 config.ascx 文件中的下一部分是 ACL 设置。默认为:
AccessControl acl = AccessControl.Add();
acl.Role = "*";
acl.ResourceType = "*"; acl.Folder = "/";
acl.FolderView = true;
acl.FolderCreate = true;
acl.FolderRename = true;
acl.FolderDelete = true;
acl.FileView = true;
acl.FileUpload = true;
acl.FileRename = true;
acl.FileDelete = true;
通过这些设置,ckfinder 不会出现任何问题,它会列出所有文件夹和文件,但每个人都具有完全权限。我想限制不同角色的删除权限。无论如何,作为一个测试,我尝试授予管理员角色
AccessControl acl = AccessControl.Add();
acl.Role = "Administrators";
acl.ResourceType = "*"; 的完全权限。 acl.Folder = "/";
acl.FolderView = true;
acl.FolderCreate = true;
acl.FolderRename = true;
acl.FolderDelete = true;
acl.FileView = true;
acl.FileUpload = true;
acl.FileRename = true;
acl.FileDelete = true;
但即使 RoleSessionVar =“Administrators”,ckfinder 也不会显示任何文件夹或文件。
我将非常感谢您对解决此问题的任何帮助。
拜伦
if somebody could help with this please.
I am trying to incorporate ckeditor and ckfinder to an Asp.Net Mvc 1 project. SO far everything is working fine. The only thing I cann't get to work right is the Access Control for ckfinder.
For what I understand, in the file ckfinder/config.ascx, the variable string RoleSessionVar is used to assign the role to be restricted. The default value is:
RoleSessionVar = "CKFinder_UserRole";
I have tree roles in my project Administrators, Editors and Contributors. So in order to get my current user Role I replace it for:
string currentRole= "";
if(HttpContext.Current.User.IsInRole("Administrators"))
{
currentRole = "Administrators";
}
else
{
if (HttpContext.Current.User.IsInRole("Editors"))
currentRole = "Editors";
else
{
if (HttpContext.Current.User.IsInRole("Contributors"))
{
currentRole = "Contributors";
}
}
}
RoleSessionVar = currentRole;
The variable gets assigned with the correct Role for the current user. The next part in the config.ascx file are the ACL settings. The default one are:
AccessControl acl = AccessControl.Add();
acl.Role = "*";
acl.ResourceType = "*";
acl.Folder = "/";
acl.FolderView = true;
acl.FolderCreate = true;
acl.FolderRename = true;
acl.FolderDelete = true;
acl.FileView = true;
acl.FileUpload = true;
acl.FileRename = true;
acl.FileDelete = true;
With these settings there are not any problems the ckfinder, it lists all the folders and files, but there with full permissions for everyone. I want to restrict deleting permissions to different Roles. Anyway just as a test I tried to give full permissions to Administrators' Role
AccessControl acl = AccessControl.Add();
acl.Role = "Administrators";
acl.ResourceType = "*";
acl.Folder = "/";
acl.FolderView = true;
acl.FolderCreate = true;
acl.FolderRename = true;
acl.FolderDelete = true;
acl.FileView = true;
acl.FileUpload = true;
acl.FileRename = true;
acl.FileDelete = true;
But ckfinder will not show any folder or file even though RoleSessionVar = "Administrators".
I'll be very thankful for any ligh to the solution of this problem.
Byron
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要执行
Session["RoleSessionVar"] = currentRole;
You need to do
Session["RoleSessionVar"] = currentRole;
你应该尝试:
Session["CKFinder_UserRole"] = currentRole;
you should try:
Session["CKFinder_UserRole"] = currentRole;