Пример #1
0
 public bool isAllowed(int pid, string fullpath, UserOwner user, GroupOwner[] usergroups)
 {
     return(isTrustedPid(pid) ||
            isUserTrusted(user) ||
            isGroupsTrusted(usergroups) ||
            isProcessPathAllowed(fullpath, user, usergroups));
 }
Пример #2
0
        public bool isUserTrusted(UserOwner user)
        {
            bool foundAllowed = false;

            if (__trustedUsersSearch[user.Type].Contains(user.Value))
            {
                foundAllowed = true;
            }

            return(foundAllowed);
        }
Пример #3
0
        public bool isProcessPathAllowed(string fullpath, UserOwner user, GroupOwner[] usergroups)
        {
            string myPath  = PathPolicy.makeStandartPath(fullpath);
            bool   allowed = false;

            if (!__allowedPathSearch.ContainsKey(myPath))
            {
                allowed = false;
            }
            else
            {
                if (__allowedPathSearch[myPath].PathFilter == PathAllowedType.ANY)
                {
                    allowed = true;
                }
                else
                {
                    if (!allowed)
                    {
                        allowed = __allowedPathSearch[myPath].AllowedUsers.Contains(user);
                    }
                    if (!allowed)
                    {
                        foreach (var item in usergroups)
                        {
                            if (__allowedPathSearch[myPath].AllowedGroups.Contains(item))
                            {
                                allowed = true;
                                break;
                            }
                        }
                    }
                }
            }

            if (PolicyMode == FilterMode.Blacklist)
            {
                allowed = !allowed;
            }

            return(allowed);
        }
Пример #4
0
        public override bool Equals(object obj)
        {
            UserOwner other = obj as UserOwner;

            return(other != null && other.Type == Type && other.Value == Value);
        }