Esempio n. 1
0
        public static void Load(IAccessControlList acl, DataTable granted, DataTable denied)
        {
            var problems = ValidateTable(granted);
            if ( problems.Count > 0 )
                throw new Exception("Invalid Access Granted Table: " + problems);

            problems = ValidateTable(denied);
            if (problems.Count > 0)
                throw new Exception("Invalid Access Denied Table: " + problems);

            for (var i = 0; i < granted.Rows.Count; i++)
            {
                var row = granted.Rows[i];

                var principal = (string) row["Principal"];
                var operation = (string)row["Operation"];
                var resource = (string)row["Resource"];

                acl.Grant(principal,operation,resource);
            }

            for (var i = 0; i < denied.Rows.Count; i++)
            {
                var row = denied.Rows[i];

                var principal = (string)row["Principal"];
                var operation = (string)row["Operation"];
                var resource = (string)row["Resource"];

                acl.Deny(principal, operation, resource);
            }
        }
        public static void Load(IAccessControlList acl, string grantedFilePath, string deniedFilePath)
        {
            var granted = LoadCsvIntoTable(grantedFilePath);
            var denied  = LoadCsvIntoTable(deniedFilePath);

            Load(acl, granted, denied);
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AclPrincipalBase" /> class.
        /// </summary>
        /// <param name="acl">The value for the <see cref="AclPrincipalBase.AccessControlList" /> property.</param>
        /// <param name="syncRoot">The value for the <see cref="TMObject._SYNC" /> field.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="acl" /> and/or <paramref name="syncRoot" /> are <see langword="null" />.
        /// </exception>
        protected AclPrincipalBase(IAccessControlList acl, object syncRoot)
            : base(syncRoot)
        {
            if (acl == null)
            {
                throw new ArgumentNullException("acl");
            }

            this._ACCESS_CONTROL_LIST = acl;
        }
Esempio n. 4
0
        public static IHtmlString For <TDomain>(this IAccessControlList lst, SecurityTarget target, string fieldName, Func <HtmlHelper, IJsControlledView> subjSelector)
        {
            //Contract.Requires( lst != null );
            //Contract.Requires( target != null );
            //Contract.Requires( !String.IsNullOrEmpty( fieldName ) );
            //Contract.Requires( subjSelector != null );
            //Contract.Ensures( //Contract.Result<IHtmlString>() != null );

            var sec = lst.Html.ViewContext.HttpContext.Composition().Get <ISecurityService <TDomain> >();

            return(lst.With(sec.DefaultAclEditModelFor(target, subjSelector), fieldName));
        }
        public static bool ContainsRightType <T>(this IAccessControlList acl, T rightType) where T : struct, IConvertible
        {
            string rt = rightType.GetFriendlyRightTypeName();

            bool found = false;

            foreach (IAccessControlEntry ace in acl)
            {
                if (ace.RightData.FriendlyTypeName.Equals(rt))
                {
                    found = true;
                    break;
                }
            }

            return(found);
        }
        public static void Load(IAccessControlList acl, DataTable granted, DataTable denied)
        {
            var problems = ValidateTable(granted);

            if (problems.Count > 0)
            {
                throw new Exception("Invalid Access Granted Table: " + problems);
            }

            problems = ValidateTable(denied);
            if (problems.Count > 0)
            {
                throw new Exception("Invalid Access Denied Table: " + problems);
            }

            for (var i = 0; i < granted.Rows.Count; i++)
            {
                var row = granted.Rows[i];

                var principal = (string)row["Principal"];
                var operation = (string)row["Operation"];
                var resource  = (string)row["Resource"];

                acl.Grant(principal, operation, resource);
            }

            for (var i = 0; i < denied.Rows.Count; i++)
            {
                var row = denied.Rows[i];

                var principal = (string)row["Principal"];
                var operation = (string)row["Operation"];
                var resource  = (string)row["Resource"];

                acl.Deny(principal, operation, resource);
            }
        }
Esempio n. 7
0
 partial void RemoveAccessControlEntry_PreCondition(IAccessControlList instance, ref IIdentityDescriptor descriptor);
Esempio n. 8
0
 partial void Token_SetCondition(ref IAccessControlList instance, ref String setValue);
Esempio n. 9
0
 partial void SetPermissions_PreCondition(IAccessControlList instance, ref IIdentityDescriptor descriptor, ref Int32 allow, ref Int32 deny, ref Boolean merge);
Esempio n. 10
0
 partial void SetPermissions_PostValidate(IAccessControlList instance, IIdentityDescriptor descriptor, Int32 allow, Int32 deny, Boolean merge);
Esempio n. 11
0
 partial void SetAccessControlEntry_PreCondition(IAccessControlList instance, ref IAccessControlEntry accessControlEntry, ref Boolean merge);
Esempio n. 12
0
 partial void SetAccessControlEntry_PostValidate(IAccessControlList instance, IAccessControlEntry accessControlEntry, Boolean merge);
Esempio n. 13
0
 partial void SetAccessControlEntries_PreCondition(IAccessControlList instance, ref IEnumerable <IAccessControlEntry> accessControlEntries, ref Boolean merge);
Esempio n. 14
0
 public static void Load(IAccessControlList acl, string grantedFilePath, string deniedFilePath)
 {
     var granted = LoadCsvIntoTable(grantedFilePath);
     var denied = LoadCsvIntoTable(deniedFilePath);
     Load(acl,granted,denied);
 }
Esempio n. 15
0
 public ApplicationServiceBus(IObjectIdService objectIdService, IUtcClockService utcClockService, IAccessControlList accessControlList)
 {
     ObjectIdService = objectIdService;
     UtcClockService = utcClockService;
     AccessControlList = accessControlList;
 }
Esempio n. 16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AclPrincipalBase" /> class.
 /// </summary>
 /// <param name="acl">The value for the <see cref="AclPrincipalBase.AccessControlList" /> property.</param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="acl" /> is <see langword="null" />.
 /// </exception>
 protected AclPrincipalBase(IAccessControlList acl)
     : this(acl, new object())
 {
 }
Esempio n. 17
0
 partial void RemoveAccessControlEntry_PostValidate(IAccessControlList instance, IIdentityDescriptor descriptor);
Esempio n. 18
0
 partial void QueryAccessControlEntries_PreCondition(IAccessControlList instance, ref IEnumerable <IIdentityDescriptor> descriptors);
Esempio n. 19
0
 partial void QueryAccessControlEntries_PostValidate(IAccessControlList instance, IEnumerable <IIdentityDescriptor> descriptors);
Esempio n. 20
0
 partial void InheritPermissions_SetCondition(ref IAccessControlList instance, ref Boolean setValue);
Esempio n. 21
0
 partial void AccessControlEntries_SetCondition(ref IAccessControlList instance, ref IEnumerable <IAccessControlEntry> setValue);
Esempio n. 22
0
 partial void RemovePermissions_PostValidate(IAccessControlList instance, IIdentityDescriptor descriptor, Int32 permissionsToRemove);
Esempio n. 23
0
 partial void RemovePermissions_PreCondition(IAccessControlList instance, ref IIdentityDescriptor descriptor, ref Int32 permissionsToRemove);
Esempio n. 24
0
 partial void AccessControlList_SetCondition(ref IQueryItem instance, ref IAccessControlList setValue);
Esempio n. 25
0
 partial void SetAccessControlEntries_PostValidate(IAccessControlList instance, IEnumerable <IAccessControlEntry> accessControlEntries, Boolean merge);
Esempio n. 26
0
 public void AclSave(IAccessControlList modifiedAcl)
 {
     _connector.Request(RequestMethod.ACL_SET, Name, null, Encoding.UTF8.GetBytes(modifiedAcl.ToXmlString()), "application/xml");
 }
Esempio n. 27
0
 internal CloudPrincipal(CloudIdentity id, IAccessControlList acl)
     : base(acl)
 {
     this._ID = id;
 }