Esempio n. 1
0
        /// <summary>
        /// Checks if the user can read the Subpath on the given Document
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="id"></param>
        /// <param name="subPath"></param>
        /// <returns></returns>
        private bool CanRead(EmergencyObject obj, EndpointIdentity id, string subPath)
        {
            bool isOwner = (obj.header.createdBy == id.uid);

            /* Nutzer ist Besitzer des Objekts */
            if (isOwner)
            {
                return(true);
            }

            /* Berechtigung über AccessLevel prüfen */
            if (access.CheckAccessForPath(subPath, id.accessIdentity, obj.header.Access, AccessLevelEnum.Read) >= AccessLevelEnum.Read)
            {
                return(true);
            }

            return(false);
        }
Esempio n. 2
0
        public void AccessPathsLevel()
        {
            AccessCheck ac = new AccessCheck();

            List <string> ids = new List <string>()
            {
                "fw.de.he.da.mkk.mtl", "fw.de.he.da.mkk.nid"
            };
            List <EmergenyObjectAccessContainer> acl = new List <EmergenyObjectAccessContainer>();

            var oa = new EmergenyObjectAccessContainer("fw.de.he.da.mkk");

            oa.AddAccessRight("stamm", AccessLevelEnum.Read);
            acl.Add(oa);
            Assert.Equal <AccessLevelEnum>(AccessLevelEnum.Read, ac.CheckAccessForPath("stamm", ids, acl));
        }