Ejemplo n.º 1
0
        /// <summary>
        /// Authoriaztion dictionary'si içerisinden istenen resource'a istenen permission bağlanmışsa bu resource'u geri verir.
        /// Ancak resource verilen permission ALLOW da olabilir DENY da olabilir. Bunu developer'ın kontrol etmesi gerekir.
        /// </summary>
        /// <param name="pResourceCode"></param>
        /// <param name="pPermissionCode"></param>
        /// <returns></returns>
        public PxResourceInfo GetResource(string pResourceCode, string pPermissionCode)
        {
            if (_resources == null || _resources.Count <= 0)
            {
                return(null);
            }

            PxResourceInfo resource;

            _resources.TryGetValue(pResourceCode, out resource);

            if (resource == null)
            {
                return(null);
            }

            PxPermissionInfo permission = resource.GetPermission(pPermissionCode);

            if (permission == null)
            {
                return(null);
            }

            return(resource);
        }
Ejemplo n.º 2
0
        public void AddPermission(PxPermissionInfo pPermission)
        {
            PxPermissionInfo existingPerm;

            if (_permissions.TryGetValue(pPermission.Code, out existingPerm))
            {
                existingPerm.IsGiven = pPermission.IsGiven;
            }
            else
            {
                _permissions.Add(pPermission.Code, pPermission);
            }
        }