Пример #1
0
        public virtual void AssignDefaultPermission(ISession session, IEnumerable <UserPermission> permissions = null)
        {
            if (permissions == null)
            {
                permissions = new UserPermission[0];
            }

            var availability = UserPermissionAvailability.Supplier;

            if (Client != null)
            {
                availability = UserPermissionAvailability.Drugstore;
            }

            var defaultPermissions = UserPermission.DefaultPermissions(session, availability);

            permissions = permissions.Concat(defaultPermissions)
                          .Distinct()
                          .Except(AssignedPermissions)
                          .ToArray();
            foreach (var permission in permissions)
            {
                AssignedPermissions.Add(permission);
            }
        }