Esempio n. 1
0
        // Need a
        // user/operation/entity to access allowed or denied (boolean)?
        //    Need to remove users when a user is deleted.
        //    Need to remove entities when a query is modified.
        //    Need to remove operations when an operation is deleted (will this ever happen)
        //
        //    Should it be role rather than user? Roles change rarely. Role membership is static so can be evaluated easily.

        /// <summary>
        /// Invalidate the cache.
        /// </summary>
        public void Invalidate()
        {
            Trace.TraceSecurityCacheInvalidate();

            foreach (ICacheService cache in Caches)
            {
                cache.Clear();
            }

            // Update performance counters
            AccessControlCacheInvalidationCounters.GetPerformanceCounter <NumberOfItems64PerformanceCounter>(
                AccessControlCacheInvalidationPerformanceCounters.CountCounterName,
                AccessControlCacheInvalidationPerformanceCounters.CacheInstanceName).Increment();
            AccessControlCacheInvalidationCounters.GetPerformanceCounter <RatePerSecond32PerformanceCounter>(
                AccessControlCacheInvalidationPerformanceCounters.RateCounterName,
                AccessControlCacheInvalidationPerformanceCounters.CacheInstanceName).Increment();
        }
Esempio n. 2
0
        /// <summary>
        /// Invalidates the role.
        /// </summary>
        /// <param name="role">The role. This cannot be null.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="role"/> cannot be null.
        /// </exception>
        public void InvalidateRole(IEntityRef role)
        {
            if (role == null)
            {
                return;
            }

            Trace.TraceSecurityCacheInvalidateRole(role.Id);

            // TODO

            // Update performance counters
            AccessControlCacheInvalidationCounters.GetPerformanceCounter <NumberOfItems64PerformanceCounter>(
                AccessControlCacheInvalidationPerformanceCounters.CountCounterName,
                AccessControlCacheInvalidationPerformanceCounters.RoleInstanceName).Increment();
            AccessControlCacheInvalidationCounters.GetPerformanceCounter <RatePerSecond32PerformanceCounter>(
                AccessControlCacheInvalidationPerformanceCounters.RateCounterName,
                AccessControlCacheInvalidationPerformanceCounters.RoleInstanceName).Increment();
        }
Esempio n. 3
0
        /// <summary>
        /// Invalidate the <paramref name="permission"/> in the cache.
        /// </summary>
        /// <param name="permission">The permission. This cannot be null.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="permission"/> cannot be null.
        /// </exception>
        public void InvalidatePermission(IEntityRef permission)
        {
            if (permission == null)
            {
                throw new ArgumentNullException("permission");
            }

            Trace.TraceSecurityCacheInvalidatePermission(permission.Id);

            // TODO

            // Update performance counters
            AccessControlCacheInvalidationCounters.GetPerformanceCounter <NumberOfItems64PerformanceCounter>(
                AccessControlCacheInvalidationPerformanceCounters.CountCounterName,
                AccessControlCacheInvalidationPerformanceCounters.PermissionInstanceName).Increment();
            AccessControlCacheInvalidationCounters.GetPerformanceCounter <RatePerSecond32PerformanceCounter>(
                AccessControlCacheInvalidationPerformanceCounters.RateCounterName,
                AccessControlCacheInvalidationPerformanceCounters.PermissionInstanceName).Increment();
        }
Esempio n. 4
0
        /// <summary>
        /// Invalidates the user.
        /// </summary>
        /// <param name="user">The user. This cannot be null.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="user"/> cannot be null.
        /// </exception>
        public void InvalidateUser(IEntityRef user)
        {
            if (user == null || !user.HasId)
            {
                return;
            }

            Trace.TraceSecurityCacheInvalidateUser(user.Id);

            // TODO

            // Update performance counters
            AccessControlCacheInvalidationCounters.GetPerformanceCounter <NumberOfItems64PerformanceCounter>(
                AccessControlCacheInvalidationPerformanceCounters.CountCounterName,
                AccessControlCacheInvalidationPerformanceCounters.UserInstanceName).Increment();
            AccessControlCacheInvalidationCounters.GetPerformanceCounter <RatePerSecond32PerformanceCounter>(
                AccessControlCacheInvalidationPerformanceCounters.RateCounterName,
                AccessControlCacheInvalidationPerformanceCounters.UserInstanceName).Increment();
        }
Esempio n. 5
0
        /// <summary>
        /// Invalidate the <paramref name="entity"/> in the cache.
        /// </summary>
        /// <param name="entity">The entity. This cannot be null.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="entity"/> cannot be null.
        /// </exception>
        public void InvalidateEntity(IEntityRef entity)
        {
            if (entity == null || !entity.HasId)
            {
                /////
                // Ignore invalid entities.
                /////
                return;
            }

            Trace.TraceSecurityCacheInvalidateEntity(entity.Id);

            // TODO

            // Update performance counters
            AccessControlCacheInvalidationCounters.GetPerformanceCounter <NumberOfItems64PerformanceCounter>(
                AccessControlCacheInvalidationPerformanceCounters.CountCounterName,
                AccessControlCacheInvalidationPerformanceCounters.EntityInstanceName).Increment();
            AccessControlCacheInvalidationCounters.GetPerformanceCounter <RatePerSecond32PerformanceCounter>(
                AccessControlCacheInvalidationPerformanceCounters.RateCounterName,
                AccessControlCacheInvalidationPerformanceCounters.EntityInstanceName).Increment();
        }