Beispiel #1
0
        protected PvpAttribute(string friendlyName, PvpAttributes index, string samlAttributeName, PvpVersion[] availableInVersions, Dictionary <PvpVersion, string> headerNames, string soapElementName)
        {
            _friendlyName        = friendlyName;
            _index               = index;
            _samlAttributeName   = samlAttributeName;
            _availableInVersions = availableInVersions;
            _headerNames         = headerNames;
            _soapElementName     = soapElementName;

            _availableInVersions.Where(
                v =>
            {
                if (!_headerNames.ContainsKey(v))
                {
                    throw new PvpInitializationException("PvpAttribute " + FriendlyName + " für Version " + v.ToString("G") + " definiert, aber kein HeaderName für diese Version definiert.");
                }
                return(false);
            }).ToList();

            _headerNames.Keys.Where(
                v =>
            {
                if (!_availableInVersions.Contains(v))
                {
                    throw new PvpInitializationException("HeaderName für Version " + v.ToString("G") + " definiert, aber PvpAttribute " + FriendlyName + " nicht für diese Version definiert.");
                }
                return(false);
            }).ToList();
        }
Beispiel #2
0
        public string[] GetAttributeValue(PvpAttributes pvpAttribute, DirectoryEntry user, List <DirectoryEntry> groups)
        {
            PvpConfigAttribute attr = GetPvpAttribute(pvpAttribute);

            if (attr != null)
            {
                return(attr.GetValue(user, groups));
            }
            return(null);
        }
Beispiel #3
0
        public string GetAttributeValue(PvpAttributes attributeName)
        {
            if (User == null || !IsValid)
            {
                return(null);
            }

            string[] values = _application.GetAttributeValue(attributeName, User, Groups);

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

            return(attributeName == PvpAttributes.ROLES ? String.Join(";", values) : String.Join(",", values));
        }
Beispiel #4
0
        public PvpConfigAttribute GetPvpAttribute(PvpAttributes key)
        {
            if (_pvpAttributes == null)
            {
                _pvpAttributes = CreatePvpAttributesDictionary();
            }

            PvpConfigAttribute attr;

            if (_pvpAttributes.TryGetValue(key, out attr))
            {
                return(attr);
            }

            ApplicationConfiguration globalApp = GlobalApplication;

            if (this != globalApp)
            {
                return(globalApp.GetPvpAttribute(key));
            }

            return(null);
        }