Ejemplo n.º 1
0
        protected override AccessResult GetAccessCore(ISecurable entity, Sitecore.Security.Accounts.Account oAccount, AccessRight oAccessRight)
        {
            #region VARIABLES

            AccessResult      oAccesResult;
            AccessExplanation oAccessExplanation;
            string            sAccessExplanationText;

            #endregion

            //Sitecore.Diagnostics.Log.Info(string.Format("GenSqlServerAuthorizationProvider.GetAccessCore, entity{0}", entity.GetUniqueId()), this);

            switch (oAccessRight.Name)
            {
            case "item:read":
            case "field:read":
            case "language:read":
            case "site:enter":
                oAccessExplanation = new AccessExplanation(string.Format("{0} acces right granted for entity {1}", oAccessRight.Name, entity.GetUniqueId()), new object[0]);
                oAccesResult       = new AccessResult(AccessPermission.Allow, oAccessExplanation);
                break;

            default:
                sAccessExplanationText = string.Format("Access right {0} is unavailable in this instance layer", oAccessRight.Name);
                oAccessExplanation     = new AccessExplanation(sAccessExplanationText, new object[0]);
                oAccesResult           = new AccessResult(AccessPermission.Deny, oAccessExplanation);
                Sitecore.Diagnostics.Log.Debug(sAccessExplanationText, this);
                break;
            }

            //Sitecore.Diagnostics.Log.Info(string.Format("GenSqlServerAuthorizationProvider.GetAccessCore, AccessResult:{0}", oAccesResult.Permission), this);

            return(oAccesResult);
        }
Ejemplo n.º 2
0
 protected override AccessResult GetAccessCore(ISecurable entity, Sitecore.Security.Accounts.Account account, AccessRight accessRight)
 {
     return(new AccessResult(AccessPermission.Allow, new AccessExplanation("Always allow authorization provider used")));
 }