Example #1
0
        public bool ScopeAllow(string code, string workgroup, string command)
        {
            if (scopedtokens.ContainsKey(code) == false)
            {
                return(false);
            }
            scopedTokenInfo info  = scopedtokens[code];
            string          build = workgroup + "/" + command;

            if ((info.AllowWorkgroups.Contains(workgroup) == true) || (info.AllowWorkgroups.Contains("+ALL") == true))
            {
                return(true);
            }
            else if (info.AllowCommands.Contains(build) == true)
            {
                return(true);
            }
            bool allowed = false;

            foreach (string A in info.AllowAccessGroups)
            {
                allowed = accessgroupcontrol.isAllowed(A, workgroup, command);
                if (allowed == true)
                {
                    break;
                }
            }
            return(allowed);
        }
Example #2
0
        protected void processScopedTokenRaw(string raw)
        {
            raw = raw.Replace(" ", "");
            string[]        bits      = raw.Split(',');
            string          code      = null;
            int             accessids = 0;
            scopedTokenInfo stinfo    = new scopedTokenInfo();

            foreach (string bit in bits)
            {
                string[] subbits = bit.Split(':');
                if (subbits[0] == "t")
                {
                    code = subbits[1];
                }
                else if (subbits[0] == "cm")
                {
                    stinfo.AllowCommands.Add(subbits[1]);
                    accessids++;
                }
                else if (subbits[0] == "cg")
                {
                    stinfo.AllowAccessGroups.Add(subbits[1]);
                    accessids++;
                }
                else if (subbits[0] == "ws")
                {
                    stinfo.AllowWorkgroups.Add(subbits[1]);
                    accessids++;
                }
            }
            if ((code != null) && (accessids > 0))
            {
                Tokens.AddScopedToken(code, stinfo);
                LogFormater.Info("Adding scopped command " + code + " with: " + accessids.ToString() + " access types");
            }
            else
            {
                LogFormater.Warn("Scoped access code: " + raw + " did not pass checks");
            }
        }
Example #3
0
 public void AddScopedToken(string code, scopedTokenInfo info)
 {
     scopedtokens.Add(code, info);
 }